>>12467If you want to make a file immutable on linux you can use the following terminal commands:
sudo chattr +i filename
If you want to undo the file immutability, type:
sudo chattr -i filename
If you want to make an entire Directory with all its contents immutable, type:
sudo chattr -R +i path/to/directory
and to undoo, type:
sudo chattr -R -i path/to/directory
chattr works directly on the file-system level , which means it's more robust than the usual user-privilege and file-permissions stuff.
if you want to check the immutability status you can type
lsattr filename
it'll give you an output with lots of dashes if it's got a -i- within the dashes that means the immutability is set.
there's lots of tutorials with more information and functionality like this one
https://www.xmodulo.com/make-file-immutable-linux.htmlif you care to know more