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