Protection from the dreaded "rm -fr /"

Dmitry Morozovsky marck at rinet.ru
Sun Oct 3 11:29:08 PDT 2004


On Sun, 3 Oct 2004, M. Warner Losh wrote:

[snip]

MWL> rm doesn't have to live in the chroot.  Consider
MWL> 	chroot /some/path/to/a/chroot rm -rf /
MWL> in this case, everything under the /some/path/to/a/chroot would be
MWL> removed.  However, the rm that's running is outside of the chroot.

Not to be too nit-picking, but this is not true, as far as I can understand
chroot(8) and chroot(2) ;-)

However, since rm is usually statically linked and/or all needed code segments
are referenced during rm work are loaded/referenced, this operation finishes
successfully (just checked on 4-STABLE and -CURRENT).

... and no, I do *NOT* want to participate in this bikesched color discussion!
;-P


Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------


More information about the freebsd-hackers mailing list