Yesterday my friend called me a bit frustrated and told someone with root access deleted files in his folder.
He asked if there is a way to prevent root from deleting files.
I did a little amount of search and found there is such a way i.e. to use "chattr"
For details you can see the man page as chattr can do a lot many things for you.
Below is the example of setting this so called "immutable" property:
chattr works on ext2 / ext3 filesystems on Linux, other OS have different implementations.
He asked if there is a way to prevent root from deleting files.
I did a little amount of search and found there is such a way i.e. to use "chattr"
For details you can see the man page as chattr can do a lot many things for you.
Below is the example of setting this so called "immutable" property:
#chattr +i <file> #chattr -R +i <file> //recursively
Above command will make the file or directory immutable from root or anyone else. In other words no one will not be able to delete or modify or even create link to this file.
chattr works on ext2 / ext3 filesystems on Linux, other OS have different implementations.
Use "lsattr" to confirm the file properties. Normal "ls" command will not tell anything.
#lsattr
To remove this immutable property:
#chattr -i <file>
Note: The chattr is only available for some Linux based systems and it doesn't work for Solaris.