home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / W2KPRK.iso / apps / posix / source / MAN / CHMOD.PRT < prev    next >
Text File  |  1999-11-17  |  5KB  |  133 lines

  1.                                                         CHMOD (1)
  2.  
  3. NAME
  4.  
  5.   chmod - change file modes
  6.  
  7. SYNOPSIS
  8.  
  9.   chmod [ R ] mode file ...
  10. DESCRIPTION
  11.  
  12.   The chmod utility modifies the file mode  bits  of  the  listed
  13. files as specified by the mode operand.
  14.   The options are as follows:
  15.      R - Traverse a file hierarchy.  For each  file  that  is  of
  16.      type  directory,  chmod changes the mode of all files in the
  17.      file hierarchy below it followed by the mode of the directo-
  18.      ry itself.
  19.   Symbolic links are not indirected through, nor are their  modes
  20. altered.
  21.   Only the owner of a file or  the  super-user  is  permitted  to
  22. change the mode of a file.
  23.   The chmod utility exits 0 on success, and >0 if  an  error  oc-
  24. curs.
  25. MODES
  26.  
  27.   Modes may be absolute or symbolic.  An absolute mode is an  oc-
  28. tal number constructed by or Ap ing the following values:
  29.      4000 - set-user-ID-on-execution
  30.      2000 - set-group-ID-on-execution
  31.      1000 - sticky bit, see chmod(2)
  32.      0400 - read by owner
  33.      0200 - write by owner
  34.      0100 - execute (or search for directories) by owner
  35.      0070 - read, write, execute/search by group
  36.      0007 - read, write, execute/search by others
  37.   The read, write, and execute/search values for group and others
  38. are encoded as described for owner.
  39.   The symbolic mode is described by the following  grammar:  mode
  40. ::= clause [, clause ...] clause       ::= [who ...] [action ...]
  41. last_action action       ::= op [perm ...]  last_action   ::=  op
  42. [perm  ...] who          ::= a | u | g | o op           ::= + | -
  43. | = perm         ::= r | s | t | w | X | x | u | g | o
  44.   The who symbols ``u'',  ``g'',  and  ``o''  specify  the  user,
  45. group,  and  other parts of the mode bits, respectively.  The who
  46. symbol ``a'' is equivalent to ``ugo''.
  47.   The perm symbols represent the portions of  the  mode  bits  as
  48. follows:
  49.       - The read bits.
  50.       -   The   set-user-ID-on-execution   and   set-group-ID-on-
  51.      execution bits.
  52.       - The sticky bit.
  53.       - The write bits.
  54.       - The execute/search bits.
  55.       - The execute/search bits if the file is a directory or any
  56.      of  the execute/search bits are set in the original (unmodi-
  57.      fied) mode.  Operations with the perm symbol ``X'' are  only
  58.      meaningful  in  conjunction with the op symbol ``+'', and it
  59.      is ignored in all other cases.
  60.   The op symbols represent the operation performed, as follows:
  61.       - If no value is supplied for perm ,  the  ``+''  operation
  62.      has  no effect.  If no value is supplied for who , each per-
  63.      mission bit specified in perm , for which the  corresponding
  64.      bit in the file mode creation mask is clear, is set.  Other-
  65.      wise, the mode bits represented by  the  specified  who  and
  66.      perm values are set.
  67.       - If no value is supplied for perm ,  the  ``-''  operation
  68.      has  no  effect.  If no value is supplied for who , the mode
  69.      bits represented by perm are cleared for  the  owner,  group
  70.      and other permissions.  Otherwise, the mode bits represented
  71.      by the specified who and perm values are cleared.
  72.       - The mode bits specified by the who value are cleared, or,
  73.      if  no  who  value  is specified, the owner, group and other
  74.      mode bits are cleared.  Then, if no value  is  supplied  for
  75.      who  , each permission bit specified in perm , for which the
  76.      corresponding bit in the file mode creation mask  is  clear,
  77.      is  set.  Otherwise, the mode bits represented by the speci-
  78.      fied who and perm values are set.
  79.   Each clause specifies one or more operations to be performed on
  80. the  mode bits, and each operation is applied to the mode bits in
  81. the order specified.
  82.   Operations upon the other permissions only  (specified  by  the
  83. symbol  ``o''  by  itself),  in combination with the perm symbols
  84. ``s'' or ``t'', are ignored.
  85. EXAMPLES
  86.  
  87.      644 - make a file readable by anyone  and  writable  by  the
  88.      owner only.
  89.        go-w - deny write permission to group and others.
  90.        =rw,+X - set the read and write permissions to  the  usual
  91.      defaults,  but  retain  any  execute  permissions  that  are
  92.      currently set.
  93.        +X - make a directory  or  file  searchable/executable  by
  94.      everyone if it is already searchable/executable by anyone.
  95.        755 -
  96.      u=rwx,go=rx -
  97.      u=rwx,go=u-w - make a file readable/executable  by  everyone
  98.      and writeable by the owner only.
  99.        go= - clear all mode bits for group and others.
  100.        g=u-w - set the group bits equal to  the  user  bits,  but
  101.      clear the group write bit.
  102. BUGS
  103.  
  104.   There's no perm option for the naughty bits.
  105. SEE ALSO
  106.  
  107.   install (1) , chmod (2) , stat (2) , umask (2) , fts (3) , set-
  108. mode (3) , chown (8)
  109. STANDARDS
  110.  
  111.   The chmod utility is expected to be compatible with the  excep-
  112. tion of the perm symbols and which are not included in that stan-
  113. dard.
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.