I’m amazed and bewildered that the sudo rm -rf / command actually worked in Ubuntu. Lowarch (and I can only assume by extension, Arch Linux) screened that command with a terse error message, although it was easily circumvented.
But Ubuntu barely blinked before completely destroying itself. It happened so fast that I barely saw the drive light flicker before the entire business was done in a puff of electronic dust. I tried both 7.04 and 7.10, and both times Ubuntu happily complied.
Even more interesting, the Ubuntu man pages for rm suggest that the default behavior for the rm command (which is part of the coreutils package, if you go looking for it) is not to protect the root directory from removal. Note that there is a --protect-root and --no-protect-root flag, which means you could override the default, no matter what it was.
It doesn’t seem right that Ubuntu should so eagerly self-destruct. To that end I’ve filed a bug report against coreutils, suggesting that the option be reversed, mostly as a protective measure against the malicious posters who think it’s funny to prey on new Linux users.
If you can comment or add to it, I’d be obliged.





Quick workaround - add this to the /etc/bashrc and /etc/profile
alias rm=”rm –preserve-root”
Sorry, but this is *not* a bug. It’s the same as going “Whoa, if I stick this knife in my stomach it hurts. Hence the knife is faulty” Linux is a *tool* and if one doesn’t know how to handle his tools, things can go wrong.
Besides, I think “rm -rf ~” is a lot worse than “sudo rm -rf /”. Setting up a new install is done in a few hours (including all customizations), but recovering all my files is impossible
What an idiot…
While you’re at it, better protect all (mounted?) devices from being written to as well. You can dd if=/dev/zero of=/dev/hda, or even adding a redirect character could result in catastrophe: fdisk -l > /dev/hda. And hey - get rid of the shred command too, cause that can do nasty things : shred /etc/* …
But I don’t really that it is a bug; this is a feature request.
A never ending feature request, I should add.
Hmm. Well, Bug or feature request, it still needs to be delt with, and would certain stop the trolls for a season.
Wow, You do know its supposed to do that; don’t you?
If you are the kind of person who has guns going off by themselves and fires started without cause I suggest doing this in /
sudo echo ‘-i’ > ‘-i’ ; chmod 000 ./’-i’
extra credit if you can delete that file.
Btw, this is not some outlandish request. Sun actually altered rm in this way in Solaris 10. I’m not saying Sun is right, or wrong but they did see this as a usability problem and they resolved it.
So, really the question here is - does Ubuntu community want to stay true to the Unix tradition of letting the user hose the system at will, or implement some rudimentary protection for the sake of novice user.
Whether bug or feature, safeguards against accidental self-destruction are and expected feature of any consumer product.
While some of the Linux cognoscenti berate the lack of knowledge exhibited by end users, I’ll bet damn few of them can overhaul an automatic transmission in an automobile. Yet, they will expect that transmission to prevent their starting the car while in gear.
Those who so roundly criticize the uninformed do so only to effect self-promotion. In so doing they wrap themselves in the shame of vanity.
@Rambo
>Whether bug or feature, safeguards against accidental self-destruction are and expected feature of any consumer product.
<
man rm
…
-f, –force
ignore nonexistent files, never prompt
…
… i agree with many of the posts above, this isnt a bug…. while i did laugh at the fact that ubuntu doesnt protect itself, i also took into account that theyre marketing ubuntu and by association Kubuntu (which i use) to be “linux for human beings”, and therefore while this command may actually have a usability to it, it should at least prompt or require some sort of confirmation before some idiot does it and then starts ANOTHER useless thread somewhere about OMGWTF I FRIED MY BOX… or something equally as annoying….but it certainly isnt a bug… once upon a time… Del C;\*.* worked too…. but it wasnt a BUG
izi,
I presume your reply aims to point out that such safeguards as exist for the rm command are intentionally being circumvented by the command syntax in question. While there is validity in such a point, it leaves little room for a typo or other human error, not to mention the malicious designs of the malevolent. For example, the f-key resides in immediate proximity to the r-key, increasing the chances that -rf could occur when all that was desired was -r.
Rambo, what do you mean when -r was all that was wanted, rm -r / will still hose the system, it’ll just ask you more questions while doing so.
too bad there is a force command… or not really. well I hope they can fix this.
You said you filed a bug report for this?! That’s really disgusting! (sorry, that’s the first word that popped into my mind)
Please do not ask for Windows practices when using Linux or other Unix-based operating systems.
I’m not saying that the Windows way is wrong. However, each OS has it’s own philosophy. The Unix philosophy allows the user to do *everything* he wants, as long as he has the necessary privileges.
In a Unix environment, programs should not impose fake limitations to the user. Let him destroy himself if he desires so! After all, rm is not the only “dangerous” command… As Gerrit said, there are many ways to hose your system, and you can actually delete all your user data even without root privileges. On a desktop machine, user data is more important than the OS itself.
The command line is a powerful tool; just as nuclear energy, whoever uses it is expected to show some responsibility. Even more when he is the system administrator. And you have to use administrator priviledges to run “rm -rf /”…