Making a file unalterable with
You can make a file unalterable so that it cannot be changed or deleted even by root:
$ chattr +i /path/to/file
After that the file becomes untouchable.
To update the file, remove the attribute using
$ chattr -i /path/to/file
-R flag to unlock a directory.
$ chattr -R -i directory/
The Mac equivalent is:
#to "lock" the file $ chflags uchg /path/to/file #to "unlock" $ chflags nouchg /path/to/file
The 5-minute daily workout for your dev skills