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.
1 | sudo chattr +i some.file |
And recursively….
1 | sudo chattr +i -RV /some.directory/ |
To remove the non-delete flag, simply use “-i” with the chattr command:
1 | sudo chattr -i some.file |