add Berkeley copyright
[unix-history] / usr / src / bin / chmod / chmod.1
CommitLineData
2da69ef2 1.\" @(#)chmod.1 6.3 (Berkeley) %G%
aed64a6e 2.\"
87a10ef1 3.TH CHMOD 1 ""
aed64a6e
KM
4.AT 3
5.SH NAME
6chmod \- change mode
7.SH SYNOPSIS
87a10ef1 8\fBchmod\fP [
16b7e896 9.B \-Rf
87a10ef1 10] mode file ...
aed64a6e 11.SH DESCRIPTION
9dfaf149
KM
12The mode of each named file is changed according to \fImode\fP,
13which may be absolute or symbolic. An absolute \fImode\fP
14is an octal number constructed from the OR of the following modes:
aed64a6e
KM
15.TP 10
164000
17set user ID on execution
18.br
aed64a6e
KM
19.ns
20.TP 10
212000
22set group ID on execution
23.br
aed64a6e
KM
24.ns
25.TP 10
261000
27sticky bit, see
28.IR chmod (2)
29.br
aed64a6e
KM
30.ns
31.TP 10
320400
33read by owner
34.br
aed64a6e
KM
35.ns
36.TP 10
370200
38write by owner
39.br
aed64a6e
KM
40.ns
41.TP 10
420100
43execute (search in directory) by owner
44.br
aed64a6e
KM
45.ns
46.TP 10
470070
48read, write, execute (search) by group
49.br
aed64a6e
KM
50.ns
51.TP 10
520007
53read, write, execute (search) by others
9dfaf149
KM
54.LP
55A symbolic \fImode\fP has the form:
aed64a6e
KM
56.IP
57.RI [ who ]
9dfaf149 58\fIop permission\fP
aed64a6e 59.RI [ "op permission" "] ..."
9dfaf149
KM
60.LP
61The \fIwho\fP part is a combination of the letters \fBu\fP
62(for user's permissions), \fBg\fP (group) and \fBo\fP (other).
63The letter \fBa\fP stands for all, or \fBugo.\fP
64If \fIwho\fP is omitted, the default is \fIa\fP
65but the setting of the file creation mask (see umask(2)) is taken into account.
66.LP
67\fIOp\fP can be \fB+\fP to add \fIpermission\fP to the file's mode,
68\fB\-\fP to take away \fIpermission\fP and \fB=\fP to assign
69\fIpermission\fP absolutely (all other bits will be reset).
70.LP
71\fIPermission\fP is any combination of the letters \fBr\fP (read),
87a10ef1
KM
72\fBw\fP (write), \fBx\fP (execute),
73\fBX\fP (set execute only if file is a directory
74or some other execute bit is set),
75\fBs\fP (set owner or group id)
76and \fBt\fP (save text \- sticky).
77Letters \fBu\fP, \fBg\fP, or \fBo\fP indicate that \fIpermission\fP
78is to be taken from the current mode.
79Omitting \fIpermission\fP
9dfaf149 80is only useful with \fB=\fP to take away all permissions.
87a10ef1
KM
81.PP
82When the
83.B \-R
84option is given,
85.I chmod
86recursively descends its directory arguments
87setting the mode for each file as described above.
2da69ef2
KM
88When symbolic links are encountered, their mode is not changed
89and they are not traversed.
16b7e896
SL
90.PP
91If the
92.B \-f
93option is given,
94.I chmod
95will not complain if it fails to change the mode
96on a file.
9dfaf149
KM
97.SH EXAMPLES
98.LP
aed64a6e 99The first example denies write permission to others,
87a10ef1 100the second makes a file executable by all if it is executable by anyone:
aed64a6e
KM
101.IP
102chmod o\-w file
103.br
87a10ef1 104chmod +X file
9dfaf149 105.LP
aed64a6e 106Multiple symbolic modes separated by commas may be given.
9dfaf149
KM
107Operations are performed in the order specified. The letter
108\fBs\fP is only useful with \fBu\fP or \fBg.\fP
109.LP
aed64a6e
KM
110Only the owner of a file (or the super-user) may change its mode.
111.SH "SEE ALSO"
9dfaf149 112ls(1), chmod(2), stat(2), umask(2), chown(8)