Chattr is a command that can be used to set file attributes that can prevent all users (even root) from deleting a file.
lsattr fileExample output of immutable file:
----i---------- filename
To prevent everyone (even root) from deleting a file:
chattr +i fileThis will now make the file 'read-only'.
To undo this:
chattr -i file
You can use the +a attribute to allow users to append information into a file only:
chattr +a