immutable
Immutable File Permissions
Chattr is a command that can be used to set file attributes that can prevent all users (even root) from deleting a file.
Viewing Immutable permissions
lsattr fileExample output of immutable file:
----i---------- filename
Setting file attributes with chattr
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
Restricting Editable files
You can use the +a attribute to allow users to append information into a file only:
chattr +a
immutable.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1