BSD 4_3 release
[unix-history] / usr / man / man1 / chmod.1
index d9138ba..859833c 100644 (file)
-.TH CHMOD 1 
+.\"    @(#)chmod.1     6.3 (Berkeley) 5/22/86
+.\"
+.TH CHMOD 1 "May 22, 1986"
+.AT 3
 .SH NAME
 chmod \- change mode
 .SH SYNOPSIS
 .SH NAME
 chmod \- change mode
 .SH SYNOPSIS
-.B chmod
-mode file ...
+\fBchmod\fP [
+.B \-Rf
+] mode file ...
 .SH DESCRIPTION
 .SH DESCRIPTION
-The mode of
-each named file
-is changed
-according to
-.I mode,
-which may be absolute or symbolic.
-An absolute
-.I mode
-is an octal
-number constructed
-from the OR of the
-following modes:
+The mode of each named file is changed according to \fImode\fP,
+which may be absolute or symbolic.  An absolute \fImode\fP
+is an octal number constructed from the OR of the following modes:
 .TP 10
 4000
 set user ID on execution
 .br
 .TP 10
 4000
 set user ID on execution
 .br
-.br
 .ns
 .TP 10
 2000
 set group ID on execution
 .br
 .ns
 .TP 10
 2000
 set group ID on execution
 .br
-.br
 .ns
 .TP 10
 1000
 sticky bit, see
 .IR  chmod (2)
 .br
 .ns
 .TP 10
 1000
 sticky bit, see
 .IR  chmod (2)
 .br
-.br
 .ns
 .TP 10
 0400
 read by owner
 .br
 .ns
 .TP 10
 0400
 read by owner
 .br
-.br
 .ns
 .TP 10
 0200
 write by owner
 .br
 .ns
 .TP 10
 0200
 write by owner
 .br
-.br
 .ns
 .TP 10
 0100
 execute (search in directory) by owner
 .br
 .ns
 .TP 10
 0100
 execute (search in directory) by owner
 .br
-.br
 .ns
 .TP 10
 0070
 read, write, execute (search) by group
 .br
 .ns
 .TP 10
 0070
 read, write, execute (search) by group
 .br
-.br
 .ns
 .TP 10
 0007
 read, write, execute (search) by others
 .ns
 .TP 10
 0007
 read, write, execute (search) by others
-.PP
-A symbolic
-.I mode
-has the form:
+.LP
+A symbolic \fImode\fP has the form:
 .IP
 .RI [ who ]
 .IP
 .RI [ who ]
-.I op permission
+\fIop permission\fP
 .RI [ "op permission" "] ..."
 .RI [ "op permission" "] ..."
+.LP
+The \fIwho\fP part is a combination of the letters \fBu\fP
+(for user's permissions), \fBg\fP (group) and \fBo\fP (other).
+The letter \fBa\fP stands for all, or \fBugo.\fP
+If \fIwho\fP is omitted, the default is \fIa\fP
+but the setting of the file creation mask (see umask(2)) is taken into account.
+.LP
+\fIOp\fP can be \fB+\fP to add \fIpermission\fP to the file's mode,
+\fB\-\fP to take away \fIpermission\fP and \fB=\fP to assign
+\fIpermission\fP absolutely (all other bits will be reset).
+.LP
+\fIPermission\fP is any combination of the letters \fBr\fP (read),
+\fBw\fP (write), \fBx\fP (execute),
+\fBX\fP (set execute only if file is a directory
+or some other execute bit is set),
+\fBs\fP (set owner or group id)
+and \fBt\fP (save text \- sticky).
+Letters \fBu\fP, \fBg\fP, or \fBo\fP indicate that \fIpermission\fP
+is to be taken from the current mode. 
+Omitting \fIpermission\fP
+is only useful with \fB=\fP to take away all permissions.
 .PP
 .PP
-The
-.I who
-part is a combination
-of the letters 
-.B u
-(for user's permissions),
-.B g
-(group)
-and
-.B o
-(other).
-The letter
-.B a
-stands for
-.B ugo.
-If
-.I who
-is omitted,
-the default is
-.I a
-but the setting of
-the file creation mask
-(see umask(2))
-is taken into account.
-.PP
-.I Op
-can be
-.B +
-to add
-.I permission
-to the file's mode,
-.B \-
-to take away
-.I permission
-and
-.B =
-to assign
-.I permission
-absolutely
-(all other bits will
-be reset).
-.PP
-.I Permission
-is any combination of the letters
-.B r
-(read),
-.B w
-(write),
-.B x
-(execute),
-.B s
-(set owner or group id)
-and
-.B t
-(save text \- sticky).
-Letters
-.BR u,
-.B g
-or
-.B o
-indicate that
-.I permission
-is to be taken
-from the current
-mode.
-Omitting
-.I permission
-is only useful
-with
-.B =
-to take away
-all permissions.
+When the
+.B \-R
+option is given, 
+.I chmod
+recursively descends its directory arguments
+setting the mode for each file as described above.
+When symbolic links are encountered, their mode is not changed
+and they are not traversed.
 .PP
 .PP
+If the
+.B \-f
+option is given,
+.I chmod
+will not complain if it fails to change the mode
+on a file.
+.SH EXAMPLES
+.LP
 The first example denies write permission to others,
 The first example denies write permission to others,
-the second makes a file executable:
+the second makes a file executable by all if it is executable by anyone:
 .IP
 chmod o\-w file
 .br
 .IP
 chmod o\-w file
 .br
-chmod +x file
-.PP
+chmod +X file
+.LP
 Multiple symbolic modes separated by commas may be given.
 Multiple symbolic modes separated by commas may be given.
-Operations are performed
-in the order specified.
-The letter
-.B s
-is only useful
-with
-.B u
-or
-.B g.
-.PP
+Operations are performed in the order specified.  The letter
+\fBs\fP is only useful with \fBu\fP or \fBg.\fP
+.LP
 Only the owner of a file (or the super-user) may change its mode.
 .SH "SEE ALSO"
 Only the owner of a file (or the super-user) may change its mode.
 .SH "SEE ALSO"
-ls(1),
-chmod(2),
-stat(2),
-umask(2),
-chown(8)
+ls(1), chmod(2), stat(2), umask(2), chown(8)