Is there any way to create to a file that root user also cant delete?
02 Answers
It's possible only with hardware-restricted write capabilities.
But if you want prevent some files from being accidentally deleted e.g. with
rm -rf /some/dir Try to set immutable attribute:
: ~ $ touch immut : ~ $ sudo chattr +i immut : ~ $ sudo rm immut rm: cannot remove 'immut': Operation not permitted Root privileges are the powers that the root account has on the system. The root account is the most privileged on the system and has absolute power over it (i.e., complete access to all files and commands).
Nothing is impossible for a root user to do. There is no way To do that.
: ~ $ touch immut : ~ $ sudo chattr +i immut : ~ $ sudo rm immut rm: cannot remove 'immut': Operation not permitted But admin still return attributes back
: ~ $ sudo chattr -i immut : ~ $ sudo rm immut done!!!