In some instances you may wish to have a file with permissions that restrict it from being removed by any user, even root. This can be accomplished with the +i flag on the chattr command – chattr changes the file attributes on a Linux file system.
sudo chattr +i some.file
sudo chattr +i -RV /some.directory/
To remove the non-delete flag, simply use “-i” with the chattr command:
sudo chattr -i some.file