Commit | Line | Data |
---|---|---|
93c136f8 C |
1 | .TH CHMOD 1 "18 January 1983" |
2 | .SH NAME | |
3 | chmod \- change mode | |
4 | .SH SYNOPSIS | |
5 | \fBchmod\fP mode file ... | |
6 | .SH DESCRIPTION | |
7 | The mode of each named file is changed according to \fImode\fP, | |
8 | which may be absolute or symbolic. An absolute \fImode\fP | |
9 | is an octal number constructed from the OR of the following modes: | |
10 | .TP 10 | |
11 | 4000 | |
12 | set user ID on execution | |
13 | .br | |
14 | .ns | |
15 | .TP 10 | |
16 | 2000 | |
17 | set group ID on execution | |
18 | .br | |
19 | .ns | |
20 | .TP 10 | |
21 | 1000 | |
22 | sticky bit, see | |
23 | .IR chmod (2) | |
24 | .br | |
25 | .ns | |
26 | .TP 10 | |
27 | 0400 | |
28 | read by owner | |
29 | .br | |
30 | .ns | |
31 | .TP 10 | |
32 | 0200 | |
33 | write by owner | |
34 | .br | |
35 | .ns | |
36 | .TP 10 | |
37 | 0100 | |
38 | execute (search in directory) by owner | |
39 | .br | |
40 | .ns | |
41 | .TP 10 | |
42 | 0070 | |
43 | read, write, execute (search) by group | |
44 | .br | |
45 | .ns | |
46 | .TP 10 | |
47 | 0007 | |
48 | read, write, execute (search) by others | |
49 | .LP | |
50 | A symbolic \fImode\fP has the form: | |
51 | .IP | |
52 | .RI [ who ] | |
53 | \fIop permission\fP | |
54 | .RI [ "op permission" "] ..." | |
55 | .LP | |
56 | The \fIwho\fP part is a combination of the letters \fBu\fP | |
57 | (for user's permissions), \fBg\fP (group) and \fBo\fP (other). | |
58 | The letter \fBa\fP stands for all, or \fBugo.\fP | |
59 | If \fIwho\fP is omitted, the default is \fIa\fP | |
60 | but 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) | |
68 | and \fBt\fP (save text \- sticky). Letters | |
69 | .BR u, | |
70 | \fBg\fP or \fBo\fP indicate that \fIpermission\fP | |
71 | is to be taken from the current mode. Omitting \fIpermission\fP | |
72 | is only useful with \fB=\fP to take away all permissions. | |
73 | .SH EXAMPLES | |
74 | .LP | |
75 | The first example denies write permission to others, | |
76 | the second makes a file executable: | |
77 | .IP | |
78 | chmod o\-w file | |
79 | .br | |
80 | chmod +x file | |
81 | .LP | |
82 | Multiple symbolic modes separated by commas may be given. | |
83 | Operations are performed in the order specified. The letter | |
84 | \fBs\fP is only useful with \fBu\fP or \fBg.\fP | |
85 | .LP | |
86 | Only the owner of a file (or the super-user) may change its mode. | |
87 | .SH "SEE ALSO" | |
88 | ls(1), chmod(2), stat(2), umask(2), chown(8) |