Do any Linux distros prevent the execution of sudo rm -rf /* so that people do not accidentally delete their hard drives if they did not know what they are doing?
Asked
Active
Viewed 1,264 times
-3
inixsoftware
- 330
- 1
- 2
- 13
-
6Shoot. that's a cron job of mine. Keeps the box virus free! :) – kobaltz Aug 08 '13 at 20:59
2 Answers
11
No; you are expected to know what you are doing. Look on the bright side! You almost certainly won't shoot yourself in the foot more than once.
Aaron Miller
- 9,782
- 24
- 39
2
The answer is not by default.
Let me add that the risk can be more subtle than your bare-bones example. Take this example:
[user@server ~]$ sudo rm -rf directory_to_delete /*
The accidental space between the directory_to_delete and the /* means that it's going to operate on both the directory_to_delete and /*, the root folder, as the root user. And it's going to do it recursively, so there goes your OS install.
That's why you need to be extremely careful when using rm -rf, especially with sudo.