File attributes
Apart from the file mode bits that control user and group read, write
and execute permissions, several file systems support file attributes
that enable further customization of allowable file operations. This
section describes some of these attributes and how to work with them.
Warning: By default, file attributes are not preserved by cp, rsync,
and other similar programs. chattr and lsattr
For ext2 and ext3 file systems, the e2fsprogs package contains the
programs lsattr and chattr that list and change a file's attributes,
respectively. Though some are not honored by all file systems, the
available attributes are:
a: append only
c: compressed
d: no dump
e: extent format
i: immutable
j: data journalling
s: secure deletion
t: no tail-merging
u: undeletable
A: no atime updates
C: no copy on write
D: synchronous directory updates
S: synchronous updates
T: top of directory hierarchy
For example, if you want to set the immutable bit on some file, use
the following command:
# chattr +i /path/to/file
To remove an attribute on a file just change + to -.