Normal users can
chmod files to make them unaccessible like
evgeniy@ubuntu:~$ touch test evgeniy@ubuntu:~$ chmod 444 test evgeniy@ubuntu:~$ echo 'test' > test bash: test: Permission denied
Can something like this be simulated for the root user?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
chattr +i * will prevent even the root account from making changes to files in the directory (until
chattr -i * is run).
Per Slartibartfast's comments, a few things you should know about chattr and the immutable attribute:
lsattrto display attributes in much the same way
lsdisplays ownership and permissions
CAP_LINUX_IMMUTABLEflag - to do so you'll want to install libcap, but it's only fair warning that capabilities are poorly documented (at best)