in reply to rm -rf /

"Warning: Do not run! For educational purposes only. Code results in system("rm -rf /") which will wipe everything of your hard drive."

If you run this as a user, all you get is permissioned denied, so it isn't quite as dangerous as you imply. Of course, anyone who would run this as root, probably could benefit from the "lesson-learned". It ( or a variant ) probably is more dangerous on Windows :-)


I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: rm -rf /
by Nkuvu (Priest) on Aug 14, 2004 at 05:42 UTC

    Strangely, I am not too keen on trying this on my own machine. But would it not delete all files owned by the user? That is, does the rm command continue through its recursion after a permission denied?

    I'm actually less concerned about losing system files than personal files. I rarely if ever change the system files, and even though I back up my personal files relatively frequently I'd be more than a little irritated to lose the changes since my last backup.

      If you run it as a user, it will hit /home which is owned by root, and give a 'permission denied', and it won't recurse into /home. The script would be more dangerous if it eval'd to /home/$user, or on windows C.

      By the way, I didn't run it from my ~home ...... I have an expendable test user solely for testing such scripts. :-)


      I'm not really a human, but I play one on earth. flash japh
Re^2: rm -rf /
by exussum0 (Vicar) on Aug 13, 2004 at 18:58 UTC
    Unless you aren't knowledged enoguh to not use root as a casual user. Yes, some people do that. :)

    ----
    Then B.I. said, "Hov' remind yourself nobody built like you, you designed yourself"