Protection from the dreaded "rm -fr /"
Sean Farley
sean-freebsd at farley.org
Sat Oct 2 08:42:19 PDT 2004
On Sat, 2 Oct 2004, Max Laier wrote:
> At very least you should consider to error out silently as POSIX
> requires "-f" to be silent. Other than that you should really look
> into the standards and what they way about rm and friends.
Personally, I would want it to throw an error for the exit, but I do not
know the standard.
> I am not a fan of providing seat belts like this. People concerned
> about this, can "alias rm 'rm -i'" etc. etc. Others have commented
> like this ...
Seat belts that prevent a destructive action that may be desired only
.0000001% (or much less) of the time do not bother me especially when
the action is from a common tool. If the tool was rarely used (i.e.,
fdisk), or the action was desired much more often, then I could see a
complaint about it.
I already have that alias; -f overrides -i. It would drive me crazy for
it to not override -i. Solaris does not allow -f to override -i and
will ask for everything you want to delete recursively. I had to always
type '/bin/rm -rf <dir>' to go around this. Highly annoying.
> If you still have to make this change, make it tuneable with a
> environment variable (and make it default to off).
Why not default on? root will not run 'rm -rf /' on purpose very often.
Once will be enough. :) Also, when and why would someone want to do
this?
Sean
-----------------------
sean-freebsd at farley.org
More information about the freebsd-hackers
mailing list