SYNOPSIS

       chmod [-R] mode file ...


DESCRIPTION

       The  mode of each named file is changed according to mode, which may be
       absolute or symbolic.  An absolute mode is an octal number  constructed
       from the OR of the following modes:

       4000      Set user ID on execution.
       20#0      Set  group  ID on execution if # is 7, 5, 3, or 1 and file is
                 not a directory.
                 Enable mandatory locking if # is 6, 4, 2, or 0  and  file  is
                 not a directory.
                 If  file is a directory, files created in this directory will
                 get the group ID of the  directory  instead  of  the  current
                 process  (may be set or cleared using explicit symbolic modes
                 only).
       1000      Sticky bit.  If file is a directory, only the  owner  of  the
                 file  or  the  super-user can rename or delete a file in that
                 directory.
       0400      Read by owner.
       0200      Write by owner.
       0100      Execute (search in directory) by owner.
       0070      Read, write, execute (search) by group.
       0007      Read, write, execute (search) by others.

       A symbolic mode has the form:

              [who] op permission [op permission] ...

       The who part is a combination of the  letters  u  (for  user's  permis-
       sions),  g (group) and o (other).  The letter a stands for ugo.  If who
       is omitted, the default is a but the setting of the file creation  mask
       (see  umask(2))  is  taken  into  account for /usr/5bin/posix/chmod and
       /usr/5bin/posix2001/chmod.

       Op can be + to add permission to the file's mode, - to take  away  per-
       mission  and  = to assign permission absolutely (all other bits will be
       reset).

       Permission is any combination of the letters r  (read),  w  (write),  x
       (execute),  X  (execute  if file is a directory or if it already has at
       least one execute bit set), s (set owner or group id), t (save  text  -
       sticky),  and  l  (mandatory locking).  Letters u, g or o indicate that
       permission is to be taken from the current mode.   Omitting  permission
       is only useful with = to take away all permissions.

       The first example denies write permission to others, the second makes a
       file executable:

              chmod o-w file
              chmod +x file

       chown(1), ls(1), chmod(2), stat(2), umask(2)


NOTES

       Use of the -R option is not generally recommended since symbolic  links
       can  lead to modification of files at arbitrary places outside the file
       hierarchies specified as arguments. The find(1) command can be used  in
       combination  with  chmod  to  achieve the desired result in a more con-
       trolled manner.  For example,

         find . ! -type l -exec chmod u+w {} +

       will add write permission for the invoking user, and

         find . -type d -exec chmod a+rx {} + -o \
                 ! -type l ! -type d -exec chmod a+r {} +

       will make the file hierarchy accessible to all users.



Heirloom Toolchest                  1/24/05                           CHMOD(1)

Man(1) output converted with man2html