Research V7 development
[unix-history] / usr / man / man1 / chmod.1
CommitLineData
c1db0f95
KT
1.TH CHMOD 1
2.SH NAME
3chmod \- change mode
4.SH SYNOPSIS
5.B chmod
6mode file ...
7.SH DESCRIPTION
8The mode of
9each named file
10is changed
11according to
12.I mode,
13which may be absolute or symbolic.
14An absolute
15.I mode
16is an octal
17number constructed
18from the OR of the
19following modes:
20.TP 10
214000
22set user ID on execution
23.br
24.br
25.ns
26.TP 10
272000
28set group ID on execution
29.br
30.br
31.ns
32.TP 10
331000
34sticky bit, see
35.IR chmod (2)
36.br
37.br
38.ns
39.TP 10
400400
41read by owner
42.br
43.br
44.ns
45.TP 10
460200
47write by owner
48.br
49.br
50.ns
51.TP 10
520100
53execute (search in directory) by owner
54.br
55.br
56.ns
57.TP 10
580070
59read, write, execute (search) by group
60.br
61.br
62.ns
63.TP 10
640007
65read, write, execute (search) by others
66.PP
67A symbolic
68.I mode
69has the form:
70.IP
71.RI [ who ]
72.I op permission
73.RI [ "op permission" "] ..."
74.PP
75The
76.I who
77part is a combination
78of the letters
79.B u
80(for user's permissions),
81.B g
82(group)
83and
84.B o
85(other).
86The letter
87.B a
88stands for
89.B ugo.
90If
91.I who
92is omitted,
93the default is
94.I a
95but the setting of
96the file creation mask
97(see umask(2))
98is taken into account.
99.PP
100.I Op
101can be
102.B +
103to add
104.I permission
105to the file's mode,
106.B \-
107to take away
108.I permission
109and
110.B =
111to assign
112.I permission
113absolutely
114(all other bits will
115be reset).
116.PP
117.I Permission
118is any combination of the letters
119.B r
120(read),
121.B w
122(write),
123.B x
124(execute),
125.B s
126(set owner or group id)
127and
128.B t
129(save text \- sticky).
130Letters
131.BR u,
132.B g
133or
134.B o
135indicate that
136.I permission
137is to be taken
138from the current
139mode.
140Omitting
141.I permission
142is only useful
143with
144.B =
145to take away
146all permissions.
147.PP
148The first example denies write permission to others,
149the second makes a file executable:
150.IP
151chmod o\-w file
152.br
153chmod +x file
154.PP
155Multiple symbolic modes separated by commas may be given.
156Operations are performed
157in the order specified.
158The letter
159.B s
160is only useful
161with
162.B u
163or
164.B g.
165.PP
166Only the owner of a file (or the super-user) may change its mode.
167.SH "SEE ALSO"
168ls(1),
169chmod(2),
170chown (1),
171stat(2),
172umask(2)