1

What would happen if I ran sudo -rm -rf /* --no-preserve-root in the bash shell that you can enable on windows

proof of shell: enter image description here

4
  • 2
    Why don't you setup a VM and try it?
    – DavidPostill
    Aug 14, 2017 at 14:55
  • 'the bash shell that you can enable on Windows' is... which shell exactly ?
    – Pacopaco
    Aug 14, 2017 at 15:59
  • You can enable the bash shell by enabling the Windows Subsystem for Linux (Beta) in the Turn Windows features on or off. This allows you to use Bash in Windows 10 (not sure about previous versions)
    – j. kay
    Aug 14, 2017 at 16:02
  • You can also delete the system from the cmd. I think that bash will delete itself, where it is hosted, or something like that (for example if it was a program, it will delete C:/ProgramFiles/Bash/) Aug 14, 2017 at 16:24

1 Answer 1

3

Bash on Ubuntu on Windows doesn't have the same isolation as a VM. There are even mount points to facilitate the use of non-Linux files from inside the Bash environment. For example, /mnt/c is the Windows C:\ structure. And since Linux programs can access that branch, dangerous commands can damage it.

I tested the total recursive deletion command (inside a Windows VM) and it did a nice job of deleting all the files my Windows account had access to. Once it finished, all my personal files were gone, including the library folders (even Desktop). Of course, the Linux commands were gone too.

For additional destructive science, I reverted the VM back to before the command and then issued it again, but with Bash on Ubuntu on Windows running as administrator. It still made a lot of "access denied" errors because not all Windows files allow full control to Administrators by default, but there was still devastation. On restart, the system bluescreened with CRITICAL_SERVICE_FAILED.

So yes, dangerous commands inside Bash can affect your host system.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.