rm -rf -Mitigating the dangers

Polytropon freebsd at edvax.de
Sun Apr 17 17:36:21 UTC 2016


On Sun, 17 Apr 2016 20:10:11 +0300, Odhiambo Washington wrote:
> With great power comes great responsibility and as such I think there
> should be a wrapper around rm to warn sysadmins that what they are about to
> do with -rf is dangerous, yes?

If you see that the command line contains -f, "force", then you
should already know what you're doing, as you're _intendedly_
avoiding any safety belts. A person _responsible_ for a system
who starts entering the "rm" command line should know what he's
doing, especially when operating in an environment where the
command line is being used (instead of a TUI or GUI file manager
that makes it less easier to do something stupid).

But no matter what you do, there simply is no universal protection
against fat fingers, lazy eyes, and tired brain cells. I know what
I'm talking about. ;-)



> Read input from sysadmin 3 times, looking strictly for their confirmation
> before effecting the `rm -rf`.

Lazy sysadmins annoyed by this security measure will write a
wrapper around it, call it "rm", and make sure the command line
arguments are provided three times identically. Problem solved. :-)

A nice idea is to use "echo" instead of "rm" first, and check the
output, if that is _really_ what you want to delete, and then,
and _only then_, replace "echo" with "rm".



> Could it be that what I am smoking/drinking is the issue here or I have
> your support? LOL

Is this because of the recent "rm -rf hoax"?

http://serverfault.com/questions/587102/monday-morning-mistake-sudo-rm-rf-no-preserve-root

http://meta.serverfault.com/questions/8696/what-to-do-with-the-rm-rf-hoax-question

Because people love car analogies... we don't have spikes in the
streets infront of traffic lights that empty the tires of a driver
who wants to surpass the red light, and forcing him to exchange
the tires when he _insists_ on crossing the red light doesn't make
the idea any better. :-)




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list