Is it possible to prevent accidental mounting and/or reformatting of a disk or partition by the root user during normal operation of a system?
For example, this happened to me a while ago:
- Under normal operation I have
/dev/sda1
mounted as/
and/dev/sdb1
mounted as/var/disk2
. - On one particular day I rewrote a thumbdrive (
/dev/sdc
) with different LiveCD images three or four times while trying to repair another computer. - One of those times I unmounted
/dev/sdb1
instead of/dev/sdc1
and overwrotesdb1
with a new filesystem, by mistake.
Normally you have to be root to do anything with low level filesystem access on any storage device.
What I'd like is to be able to lock myself out of /dev/sda
and /dev/sdb
any time I'm running the live operating system from /dev/sda1
(as opposed to having booted from a LiveCD which I would never want to place any limits upon.)
Update in response to loevborg (thanks): I think what I really need is complete unrestricted access to /dev/sdc
(or any other device that might show up when I plug in a USB block device) as a non-root user. Is this possible -- erasing, creating a filesystem, mounting -- as non-root if I set permissions somewhere or add myself to the correct group?