BSD 4_1c_2 release
[unix-history] / usr / man / man1 / chmod.1
CommitLineData
3f162d28
C
1.TH CHMOD 1 "18 January 1983"
2.SH NAME
3chmod \- change mode
4.SH SYNOPSIS
5\fBchmod\fP mode file ...
6.SH DESCRIPTION
7The mode of each named file is changed according to \fImode\fP,
8which may be absolute or symbolic. An absolute \fImode\fP
9is an octal number constructed from the OR of the following modes:
10.TP 10
114000
12set user ID on execution
13.br
14.ns
15.TP 10
162000
17set group ID on execution
18.br
19.ns
20.TP 10
211000
22sticky bit, see
23.IR chmod (2)
24.br
25.ns
26.TP 10
270400
28read by owner
29.br
30.ns
31.TP 10
320200
33write by owner
34.br
35.ns
36.TP 10
370100
38execute (search in directory) by owner
39.br
40.ns
41.TP 10
420070
43read, write, execute (search) by group
44.br
45.ns
46.TP 10
470007
48read, write, execute (search) by others
49.LP
50A symbolic \fImode\fP has the form:
51.IP
52.RI [ who ]
53\fIop permission\fP
54.RI [ "op permission" "] ..."
55.LP
56The \fIwho\fP part is a combination of the letters \fBu\fP
57(for user's permissions), \fBg\fP (group) and \fBo\fP (other).
58The letter \fBa\fP stands for all, or \fBugo.\fP
59If \fIwho\fP is omitted, the default is \fIa\fP
60but the setting of the file creation mask (see umask(2)) is taken into account.
61.LP
62\fIOp\fP can be \fB+\fP to add \fIpermission\fP to the file's mode,
63\fB\-\fP to take away \fIpermission\fP and \fB=\fP to assign
64\fIpermission\fP absolutely (all other bits will be reset).
65.LP
66\fIPermission\fP is any combination of the letters \fBr\fP (read),
67\fBw\fP (write), \fBx\fP (execute), \fBs\fP (set owner or group id)
68and \fBt\fP (save text \- sticky). Letters
69.BR u,
70\fBg\fP or \fBo\fP indicate that \fIpermission\fP
71is to be taken from the current mode. Omitting \fIpermission\fP
72is only useful with \fB=\fP to take away all permissions.
73.SH EXAMPLES
74.LP
75The first example denies write permission to others,
76the second makes a file executable:
77.IP
78chmod o\-w file
79.br
80chmod +x file
81.LP
82Multiple symbolic modes separated by commas may be given.
83Operations are performed in the order specified. The letter
84\fBs\fP is only useful with \fBu\fP or \fBg.\fP
85.LP
86Only the owner of a file (or the super-user) may change its mode.
87.SH "SEE ALSO"
88ls(1), chmod(2), stat(2), umask(2), chown(8)
89.SH MESSAGES
90.LP
91.IP "Usage: chmod [ugoa][+-=][rwxstugo] file ..." 10
92.br
93Standard memory jogger message indicating how to use the \fIchmod\fP command.
94.IP "chmod: can't access \fIfilename\fP" 10
95.br
96The file or directory specified by \fIfilename\fP does not exist.
97.IP "chmod: can't change \fIfilename\fP" 10
98.br
99You are trying to change permissions on a file or directory which you don't own.
100.IP "chmod: invalid mode" 10
101.br
102The file mode specified on the command line is incorrect. This often
103happens when you type the filename first and the mode second.