Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Oct 2004 11:14:55 -0700
From:      Greg Shenaut <gkshenaut@ucdavis.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Protection from the dreaded "rm -fr /"
Message-ID:  <20A89EEC-1568-11D9-867A-000A9590A44E@ucdavis.edu>
In-Reply-To: <20041003.113739.95785967.imp@bsdimp.com>
References:  <20041002210554.GS35869@seekingfire.com> <20041002.192951.35870461.imp@bsdimp.com> <20041003030946.GV35869@seekingfire.com> <20041003.113739.95785967.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The "rm -fr /" is not dreaded.  What is dreaded is running that
command and other equally dangerous "rm" variants by mistake.
Usually, the mistake comes from not paying attention to what you
are typing or where you are in the directory hierarchy (for example,
"rm -rf *" is probably much more likely than "rm -rf /" and can be
equally destructive if run in the wrong directory).

One practical solution to this "problem" is to train people not to
use the "rm" command, in favor of some other command--say, "del"--with
no "recursive", "force", or other options.

For example,

    !#/bin/sh
    rm -- $*

would probably be close to what is needed by a /usr/bin/del command.

For most users, there would be no "rm" command, just as there is
currently no "dd" or "mknod" command.  If someone does the research
to discover rm(1), and if they make the decision to use it by default
instead of "del", then there's nothing anyone can do to protect
them.  But if "del" is advertised as the "safer" version of "rm",
and it is recommended to users that it be the default, with "rm"
reserved for special, extreme cases, then I think you will get the
desired result, with zero breakage of existing scripts & conventions.

Greg Shenaut



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20A89EEC-1568-11D9-867A-000A9590A44E>