Annotation of 43BSDReno/bin/chmod/chmod.1, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
                      2: .\" All rights reserved.
                      3: .\"
                      4: .\" Redistribution and use in source and binary forms are permitted provided
                      5: .\" that: (1) source distributions retain this entire copyright notice and
                      6: .\" comment, and (2) distributions including binaries display the following
                      7: .\" acknowledgement:  ``This product includes software developed by the
                      8: .\" University of California, Berkeley and its contributors'' in the
                      9: .\" documentation or other materials provided with the distribution and in
                     10: .\" all advertising materials mentioning features or use of this software.
                     11: .\" Neither the name of the University nor the names of its contributors may
                     12: .\" be used to endorse or promote products derived from this software without
                     13: .\" specific prior written permission.
                     14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     17: .\"
                     18: .\"     @(#)chmod.1    6.10 (Berkeley) 7/24/90
                     19: .\"
                     20: .Dd July 24, 1990
                     21: .Dt CHMOD 1
                     22: .Os BSD 4.4
                     23: .Sh NAME
                     24: .Nm chmod
                     25: change file modes
                     26: .Sh SYNOPSIS
                     27: .Nm chmod
                     28: .Op Fl fR
                     29: .Ar mode
                     30: .Ar file ...
                     31: .Sh DESCRIPTION
                     32: The
                     33: .Nm chmod
                     34: utility modifies the file mode bits of the listed files
                     35: as specified by the
                     36: .Ar mode
                     37: operand.
                     38: .Pp
                     39: The options are as follows:
                     40: .Tw Ds
                     41: .Tp Fl f
                     42: .Nm chmod
                     43: will still exit 0 and not complain if it fails to change the mode
                     44: on a file.
                     45: .Tp Fl R
                     46: Traverse a file hierarchy.
                     47: For each file that is of type directory,
                     48: .Nm chmod
                     49: changes the mode of all files in the file hierarchy below it followed
                     50: by the mode of the directory itself.
                     51: .Tp
                     52: .Pp
                     53: Symbolic links are not indirected through, nor are their modes altered.
                     54: .Pp
                     55: Only the owner of a file or the super-user is permitted to change
                     56: the mode of a file.
                     57: .Pp
                     58: The
                     59: .Nm chmod
                     60: utility exits 0 on success, and >0 if an error occurs.
                     61: .Sh MODES
                     62: Modes may be absolute or symbolic.
                     63: An absolute mode is an octal number constructed by
                     64: .Cx Ar or
                     65: .Cx 'ing
                     66: .Cx
                     67: the following values:
                     68: .Df I
                     69: .Dw Fl
                     70: .Dp Li 4000
                     71: set-user-ID-on-execution
                     72: .Dp Li 2000
                     73: set-group-ID-on-execution
                     74: .Dp Li 1000
                     75: sticky bit, see chmod(2)
                     76: .Dp Li 0400
                     77: read by owner
                     78: .Dp Li 0200
                     79: write by owner
                     80: .Dp Li 0100
                     81: execute (or search for directories) by owner
                     82: .Dp Li 0070
                     83: read, write, execute/search by group
                     84: .Dp Li 0007
                     85: read, write, execute/search by others
                     86: .Dp
                     87: .De
                     88: .Pp
                     89: The read, write, and execute/search values for group and others
                     90: are encoded as described for owner.
                     91: .Pp
                     92: The symbolic mode is described by the following grammar:
                     93: .Dp Li mode
                     94: ::= clause
                     95: .Op  \&, clause
                     96: ...
                     97: .Dp Li clause
                     98: ::=
                     99: .Op  who ...
                    100: .Op  action ...
                    101: last_action
                    102: .Dp Li action
                    103: ::= op perm ...
                    104: .Dp Li last_action
                    105: ::= op
                    106: .Op  perm ...
                    107: .Dp Li who
                    108: .Li ::= a | u | g | o
                    109: .Dp Li op
                    110: .Li ::= + |  - |  =
                    111: .Dp Li perm
                    112: .Li ::= r |  s |  t |  w |  X |  x
                    113: .Dp
                    114: .Pp
                    115: The
                    116: .Ar who
                    117: symbols ``u'', ``g'', and ``o'' specify the user, group, and other parts
                    118: of the mode bits, respectively.
                    119: The
                    120: .Ar who
                    121: symbol ``a'' is equivalent to ``ugo''.
                    122: .Pp
                    123: The
                    124: .Ar perm
                    125: symbols represent the portions of the mode bits as follows:
                    126: .Dw Ds
                    127: .Dp r
                    128: The read bits.
                    129: .Dp s
                    130: The set-user-ID-on-execution and set-group-ID-on-execution bits.
                    131: .Dp t
                    132: The sticky bit.
                    133: .Dp w
                    134: The write bits.
                    135: .Dp x
                    136: The execute/search bits.
                    137: .Dp X
                    138: The execute/search bits if the file is a directory or any of the
                    139: execute/search bits are set in the original (unmodified) mode.
                    140: Operations with the
                    141: .Ar perm
                    142: symbol ``X'' are only meaningful in conjunction with the
                    143: .Ar op
                    144: symbol ``+'', and it is ignored in all other cases.
                    145: .Dp
                    146: .Pp
                    147: The
                    148: .Ar op
                    149: symbols represent the operation performed, as follows:
                    150: .Tw Ds
                    151: .Tp \&+
                    152: If no value is supplied for
                    153: .Ar perm ,
                    154: the ``+'' operation has no effect.
                    155: If no value is supplied for
                    156: .Ar who ,
                    157: each permission bit specified in
                    158: .Ar perm ,
                    159: for which the corresponding bit in the file mode creation mask
                    160: is clear, is set.
                    161: Otherwise, the mode bits represented by the specified
                    162: .Ar who
                    163: and
                    164: .Ar perm
                    165: values are set.
                    166: .Tp \&-
                    167: If no value is supplied for
                    168: .Ar perm ,
                    169: the ``-'' operation has no effect.
                    170: If no value is supplied for
                    171: .Ar who ,
                    172: the mode bits represented by
                    173: .Ar perm
                    174: are cleared for the owner, group and other permissions.
                    175: Otherwise, the mode bits represented by the specified
                    176: .Ar who
                    177: and
                    178: .Ar perm
                    179: values are cleared.
                    180: .Tp \&=
                    181: The mode bits specified by the
                    182: .Ar who
                    183: value are cleared, or, if no who value is specified, the owner, group
                    184: and other mode bits are cleared.
                    185: Then, if no value is supplied for
                    186: .Ar who ,
                    187: each permission bit specified in
                    188: .Ar perm ,
                    189: for which the corresponding bit in the file mode creation mask
                    190: is clear, is set.
                    191: Otherwise, the mode bits represented by the specified
                    192: .Ar who
                    193: and
                    194: .Ar perm
                    195: values are set.
                    196: .Tp
                    197: .Pp
                    198: Each
                    199: .Ar clause
                    200: specifies one or more operations to be performed on the mode
                    201: bits, and each operation is applied to the mode bits in the
                    202: order specified.
                    203: .Pp
                    204: Operations upon the other permissions only (specified by the symbol
                    205: ``o'' by itself), in combination with the
                    206: .Ar perm
                    207: symbols ``s'' or ``t'', are ignored.
                    208: .Sh EXAMPLES
                    209: .Tw Ar
                    210: .Tp ``644''
                    211: make a file readable by anyone and writable by the owner only.
                    212: .Tp ``go-w''
                    213: deny write permission to group and others.
                    214: .Tp ``=rw,+X''
                    215: set the read and write permissions to the usual defaults, but
                    216: retain any execute permissions that are currently set.
                    217: .Tp ``+X''
                    218: make a directory or file searchable/executable by everyone if it is
                    219: already searchable/executable by anyone.
                    220: .Tp ``755'' or ``u=rwx,go=rx''
                    221: make a file readable/executable by everyone and writeable by the owner only.
                    222: .Tp ``go=''
                    223: clear all mode bits for group and others.
                    224: .Tp
                    225: .Sh BUGS
                    226: There's no
                    227: .Ar perm
                    228: option for the naughty bits.
                    229: .Sh SEE ALSO
                    230: .Xr install 1 ,
                    231: .Xr chmod 2 ,
                    232: .Xr fts 2 ,
                    233: .Xr stat 2 ,
                    234: .Xr umask 2 ,
                    235: .Xr setmode 3 ,
                    236: .Xr chown 8
                    237: .Sh STANDARDS
                    238: The
                    239: .Nm chmod
                    240: utility is expected to be POSIX 1003.2 compatible with the exception
                    241: of the
                    242: .Ar perm
                    243: symbols ``t'' and ``X'' which are not included in that standard.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.