chattr
Summary
chattr
is use to change file attributes on a Linux file system.
The format of a symbolic mode is +-=[acdeijstuADST].
The operator ‘+’ causes the selected attributes to be added to the existing attributes of the files; ‘-’ causes them to be removed; and ‘=’ causes them to be the only attributes that the files have.
The letters ‘acdeijstuADST’ select the new attributes for the files:
- append only (a)
- compressed (c)
- no dump (d)
- extent format (e)
- immutable (i)
- data journalling (j)
- secure deletion (s)
- no tail-merging (t)
- undeletable (u)
- no atime updates (A)
- synchronous directory updates (D)
- synchronous updates (S)
- top of directory hierarchy (T).
Usage
Make a file immutable
Making a file immutable means it cannot be changed.
$ chattr +i <filename>
Remove file immutable
$ chattr -i <filename>