5 ms·
# cd # rm -rf * I'm wondering why they can delete files under /bin and /dev?
by zellux 17y ago
# cd
# rm -rf *
I'm wondering why they can delete files under /bin and /dev?
- rdtsc 17y agoBecause they are root and those are just files. Perhaps they need to alias rm to 'rm -I' (-I : prompt once before removal)? I remember one of the MandrakeLinux versions had that enabled by default many years ago. It saved me a couple of times when I was still a Unix noobie.
- olefoo 17y ago"Because they are root and those are just files." Just because you are root doesn't mean you should be able to do whatever you like to the filesystem at any time. Most modern unix variants (including linux) support file attributes such as immutability, see the man page for chattr(1) if you want more. In BSD land there is additionally the concept of Secure Levels which limit the ability of root to change file attributes under different circumstances; generally you have to reboot into single user mode to overwrite files or directories marked as immutable or delete ones marked as append_only.
- fhars 17y agoAccording to the FreeBSD chflags(1) manpage: The chflags command first appeared in 4.4BSD. Which puts it about seven years after this story.
- zellux 17y agoAFAIK a single cd command will set current working directory to /root, and rm -rf will only remove everything under /root. Or does cd command had different behavior in Unix at that time, comparing to shells today?
- olefoo 17y agoDid that version of BSD have secure levels? Updating systems where the system binaries are marked immutable can sometimes be a pain; but the comfort level it provides is remarkable.