chattr

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ghettoblaster (talk | contribs) at 18:31, 8 May 2008 (use cols). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

chattr is a Unix command that allows a user to set certain attributes to a file. Mostly chattr is used to make files immutable so that password files and certain system files cannot be erased during software upgrades.[1]

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 the i attribute.

On modern BSD systems (including Mac OS X) the equivalent command is chflags.

Attributes

Some attributes include:

Details of the attributes can be found in the chattr man page.[2]

See also

  • lsattr – view file attributes
  • chown – change file/directory ownership
  • chmod – change Unix access control attributes
  • cacls – Microsoft Windows NT file system ACL control utility
  • attrib – available on DOS and other systems

References=

  1. ^ chflags(1) – OpenBSD General Commands Manual
  2. ^ chattr man