News for hackers. Stuff that matters.
Re:Suicide Linux (2011) by zimbatm on Saturday April 18, 2015 @05:52PM (#9401211)
Reversely, I wonder why `rm` hasn't been patched to abort when the `/` path is passed as an argument (with maybe a --no-really-i-mean-it argument for the really rare cases where that's what you want)

EDIT: not sure why this is being down-voted. It's just an idea, albeit possibly a bad one.

Re:Suicide Linux (2011) by rwos on Saturday April 18, 2015 @05:54PM (#9401218)
GNU rm has exactly that built-in:

    $ rm -rf /
    rm: it is dangerous to operate recursively on ‘/’
    rm: use --no-preserve-root to override this failsafe
Re:Suicide Linux (2011) by tombrossman on Saturday April 18, 2015 @06:34PM (#9401352)
Go on, fire up a cheap VPS somewhere like DigitalOcean and run "rm -rf / --no-preserve-root". Maybe I am too easily amused but as a long-time Linux user on the desktop this is one of those things I always wanted to try. After it runs, you can't even shut down or run anything else, you just kill the SSH session.
Re:Suicide Linux (2011) by amelius on Saturday April 18, 2015 @06:03PM (#9401246)
The problem with this kind of safety nets is that it may break scripts that rely on this to work.
Re:Suicide Linux (2011) by erydo on Saturday April 18, 2015 @06:13PM (#9401282)
How many daily-use scripts do you suppose intentionally run `rm -rf /`? Cost-benefit for common use seams clearly in favour of adding a failsafe.
Re:Suicide Linux (2011) by Lambdanaut on Saturday April 18, 2015 @06:14PM (#9401286)
It's a good thing you can fix the script by adding that flag into them.
Re:Suicide Linux (2011) by brianmwaters_hn on Saturday April 18, 2015 @06:27PM (#9401328)
I think this is kind of antithetical to the Unix philosophy.

If you add special exceptions for things like "rm -rf /" then you start to wonder, why not add exceptions for other dangerous things, like "find / -delete" and "rm -rf /usr".

In general, most of the basic Unix tools operate off of relatively simple first principles and don't contain exceptions for things like this.

Re:Suicide Linux (2011) by marcosdumay on Saturday April 18, 2015 @10:11PM (#9401794)
When young I once had the opinion that such exceptions would be a good thing.

That is, until I installed some version of Red Hat that aliased rm to "rm -i", and extracted a few wrong tar files. Then I understood why the shell is that way, and why everybody just clicks "ok" on Windows dialog boxes without reading the alerts. Funny thing is that I lost some important files because I expected the prompt, but pressed "y" 19 times, instead of 18...

Nowadays I Just do backups.

Re:Suicide Linux (2011) by __david__ on Sunday April 19, 2015 @02:23AM (#9402218)
First off, as someone already pointed out GNU rm does fail on `rm -rf /`. Secondly, that one is way more important than trying to protect `find / -delete` and `rm -rf /usr` because it's just way easier to mess up and have a stray slash in your command line.

Case in point, a unix novice coworker of mine came up to me once and said, I think I might have done something wrong. I'm trying to remove an empty directory and it's hanging. Turned out he created a directory in whatever linux workspace gui he was running at the time and accidentally added a space at the end. He didn't notice until he used terminal `ls` to look at it and then noticed it printed like this (with `ls -F`):

  somedir /
So he decided to rm it and start over. Can you guess what he typed?
Re:Suicide Linux (2011) by brianmwaters_hn on Sunday April 19, 2015 @08:19AM (#9402883)
For the record, GNU's Not Unix.
Re:Suicide Linux (2011) by cgag on Saturday April 18, 2015 @06:06PM (#9401258)
tarsnap forces you to type "No Tomorrow" when you try to delete all your backup. Something like that would be great.