Protection from the dreaded "rm -fr /"

Giorgos Keramidas keramida at freebsd.org
Sat Oct 2 16:28:47 PDT 2004


On 2004-10-02 21:16, Michael Reifenberger <mike at reifenberger.com> wrote:
>> Exactly. Who would expect `rm -rf /` to actually succeed? It's not
>> only dangerous, it doesn't work in a useful way ;-)
>>
>> If one is thinking about `rm -rf /`, `newfs` is probably the right
>> answer.
>
> newfs only works if the root is not mounted because otherwise the
> device is locked.

No it doesn't.  You're just protected by GEOM's locking of the partition
table for mounted partitions.

> (Hmm is GEOM too anti foot shooting?

Yes.

> But can't you reenable foot-shooting via sysctl?)

Not via a sysctl, but there is an ioctl to do that now: DIOCSMBR.
See revision 1.14 of src/usr.sbin/boot0cfg/boot0cfg.c for an example.



More information about the freebsd-hackers mailing list