Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,672
Rep:
I would recommend that you do not run rm -rf /. However, under most modern distributions it will not work. As evidenced by my quick test on a Debian machine.
Code:
root@debian:~# rm -rf /
rm: it is dangerous to operate recursively on `/'
rm: use --no-preserve-root to override this failsafe
root@debian:~#
It used to be a bit of a cruel joke that people in the know told people to type it as the answer to a problem.
You're quite right. The OP should make sure to insert and mount any and all USB sticks and removable hard drives that he owns, before running the command (with sudo).
Yes, Oct 31, 2007 isn't really "modern" is it? If that is real I am surprised it took them as long as it did to protect against this.
I would argue that the "protection" isn't really the right solution to the problem, as you're not supposed to do system administration such as file management as root. And you're not supposed to store important data on systems that aren't backed up properly on a regular basis.
The command line contains a staggering amount of potentially deadly traps for an inexperienced user to fall into. For instance, imagine something as mundane as copying or moving all files in a directory to a different location with cp * ../newdir or mv * ../newdir. Now leave out the "../newdir" part by pressing Enter too soon. Ouch. (In the latter case, probably something slightly stronger.)
Granted, I see few valid uses for a recursive rm in /, but still.
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,672
Rep:
Quote:
Originally Posted by Ser Olmy
I would argue that the "protection" isn't really the right solution to the problem, as you're not supposed to do system administration such as file management as root. And you're not supposed to store important data on systems that aren't backed up properly on a regular basis.
I think it's there because that particular line has pretty much only malicious uses. I agree that protecting commands isn't generally the best way to do things but in this case and especially for a distro like Ubuntu (the one in the video) I think it may be worth it. I know there are other ways to do the same but "rm -rf /" is found posted as an answer to everything and I suspect is in a heck of a lot of shell scripts too.
Is asking the question not against forum rules - the OP has a single post and asking the question is an invitation to try it - I suggest deleting the thread.
I would recommend that you do not run rm -rf /. However, under most modern distributions it will not work. As evidenced by my quick test on a Debian machine.
Code:
root@debian:~# rm -rf /
rm: it is dangerous to operate recursively on `/'
rm: use --no-preserve-root to override this failsafe
root@debian:~#
It used to be a bit of a cruel joke that people in the know told people to type it as the answer to a problem.
Yeah, the --preserve-root option is a safeguard, the --no-preserve-root will override this and delete everything that you have permission to delete. If you do it, you only have yourself to blame...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.