- Chattr
chattr is a
Linux command that allows a user to set certain attributes on a file. Mostly chattr is used to make files "immutable" so that password files and certain system files cannot be erased during software upgrades.man|1|chflags|OpenBSD] It is analogous to the
command onattrib DOS ,OS/2 andMicrosoft Windows operating system s, and "chflags" on modernBSD systems (includingMac OS X ). OtherUnix systems have no analogous commands; Solaris supports extended file attributes, but there are no user level commands for setting or changing them, and the chatr command in HP-UX, and chattr in AIX have unrelated functions.yntax
The form of the chattr command is:
chattr [-RV] [-+=AacDdijsSu] [-v version] files
where
*
-R
is to recurse all subdirectories
*+i
is to set the immutable bit to prevent even root from erasing or changing the contents a file.Note: The
superuser can't erase or write on the file, but he or she can set or unset thei
attribute.Attributes
Some attributes include:
* don't update atime (A)
* synchronous updates (S)
* synchronous directory updates (D)
* append only (a)
* compressed (c)
* no dump (d)
* immutable (i)
* data journalling (j)
* secure deletion (s)
* top of directory hierarchy (T)
* no tail-merging (t)
* undeletable (u)See also
*
– view file attributeslsattr
*
– change file/directory ownershipchown
*
– change file access control attributeschmod
*
– Microsoft Windows NT file system ACL control utilitycacls Notes
References
*man|1|chflags|OpenBSD
*man|1|chflags|FreeBSD
Wikimedia Foundation. 2010.