We all know the destructive power of the following command executed as root:
rm -rf /
Related questions:
I fail to see when this particular combination of parameters would be useful, since it destroys the whole system and there are more efficient ways to do that. The rm
command could check for these specific parameters, and implement some kind of safeguard - ask for confirmation at the very least, despite the -f
parameter.
Why is there no such safeguard in the rm
command?
I'm well aware that you must be extra careful when you execute commands as root. With great power (...). However shouldn't this specific case be an exception to that rule?
rm -rf /
is performed afterchroot
?set -u
is your friend. If you setvariable=
though, nothing can save you except defensive programming.