Sometimes it is necessary to prevent all users including root from deleting a file. This is often done by changing the file attributes on a Linux file system. The tool used to change file attributes in Linux and other Unix systems is chattr
and the tool used to view the newly set attributes is lsattr
.
The format of a symbolic mode is +-=[acdeijstuADST]
. The format of a symbolic mode is +-=[acdeijstuADST] and they select the new attributes for
the files.
- The operator ‘+’ causes the selected attributes to be added
to the existing attributes of the files - ‘-’ causes them to be removed
- ‘=’ causes them to be the only attributes that the files have.
See explanation of all letters used below: