-
Notifications
You must be signed in to change notification settings - Fork 0
/
.INTEGER,
269 lines (240 loc) · 8.61 KB
/
.INTEGER,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
CHMOD(1) User Commands CHMOD(1)
NNAAMMEE
chmod - change file mode
bits
SSYYNNOOPPSSIISS
cchhmmoodd [_O_P_T_I_O_N]...
_M_O_D_E[_,_M_O_D_E]... _F_I_L_E...
cchhmmoodd [_O_P_T_I_O_N]... _O_C_T_A_L_-
_M_O_D_E _F_I_L_E...
cchhmmoodd [_O_P_T_I_O_N]... _-_-_r_e_f_e_r_‐
_e_n_c_e_=_R_F_I_L_E _F_I_L_E...
DDEESSCCRRIIPPTTIIOONN
This manual page documents
the GNU version of cchhmmoodd.
cchhmmoodd changes the file mode
bits of each given file
according to _m_o_d_e, which
can be either a symbolic
representation of changes
to make, or an octal number
representing the bit pat‐
tern for the new mode bits.
The format of a symbolic
mode is
[uuggooaa...][[--++==][_p_e_r_m_s...]...],
where _p_e_r_m_s is either zero
or more letters from the
set rrwwxxXXsstt, or a single
letter from the set uuggoo.
Multiple symbolic modes can
be given, separated by com‐
mas.
A combination of the let‐
ters uuggooaa controls which
users' access to the file
will be changed: the user
who owns it (uu), other
users in the file's group
(gg), other users not in the
file's group (oo), or all
users (aa). If none of
these are given, the effect
is as if (aa) were given,
but bits that are set in
the umask are not affected.
The operator ++ causes the
selected file mode bits to
be added to the existing
file mode bits of each
file; -- causes them to be
removed; and == causes them
to be added and causes
unmentioned bits to be
removed except that a
directory's unmentioned set
user and group ID bits are
not affected.
The letters rrwwxxXXsstt select
file mode bits for the
affected users: read (rr),
write (ww), execute (or
search for directories)
(xx), execute/search only if
the file is a directory or
already has execute permis‐
sion for some user (XX), set
user or group ID on execu‐
tion (ss), restricted dele‐
tion flag or sticky bit
(tt). Instead of one or
more of these letters, you
can specify exactly one of
the letters uuggoo: the per‐
missions granted to the
user who owns the file (uu),
the permissions granted to
other users who are members
of the file's group (gg),
and the permissions granted
to users that are in nei‐
ther of the two preceding
categories (oo).
A numeric mode is from one
to four octal digits (0-7),
derived by adding up the
bits with values 4, 2, and
1. Omitted digits are
assumed to be leading
zeros. The first digit
selects the set user ID (4)
and set group ID (2) and
restricted deletion or
sticky (1) attributes. The
second digit selects per‐
missions for the user who
owns the file: read (4),
write (2), and execute (1);
the third selects permis‐
sions for other users in
the file's group, with the
same values; and the fourth
for other users not in the
file's group, with the same
values.
cchhmmoodd never changes the
permissions of symbolic
links; the cchhmmoodd system
call cannot change their
permissions. This is not a
problem since the permis‐
sions of symbolic links are
never used. However, for
each symbolic link listed
on the command line, cchhmmoodd
changes the permissions of
the pointed-to file. In
contrast, cchhmmoodd ignores
symbolic links encountered
during recursive directory
traversals.
SSEETTUUIIDD AANNDD SSEETTGGIIDD BBIITTSS
cchhmmoodd clears the set-group-
ID bit of a regular file if
the file's group ID does
not match the user's effec‐
tive group ID or one of the
user's supplementary group
IDs, unless the user has
appropriate privileges.
Additional restrictions may
cause the set-user-ID and
set-group-ID bits of _M_O_D_E
or _R_F_I_L_E to be ignored.
This behavior depends on
the policy and functional‐
ity of the underlying cchhmmoodd
system call. When in
doubt, check the underlying
system behavior.
cchhmmoodd preserves a direc‐
tory's set-user-ID and set-
group-ID bits unless you
explicitly specify other‐
wise. You can set or clear
the bits with symbolic
modes like uu++ss and gg--ss, and
you can set (but not clear)
the bits with a numeric
mode.
RREESSTTRRIICCTTEEDD DDEELLEETTIIOONN FFLLAAGG OORR SSTTIICCKKYY
BBIITT
The restricted deletion
flag or sticky bit is a
single bit, whose interpre‐
tation depends on the file
type. For directories, it
prevents unprivileged users
from removing or renaming a
file in the directory
unless they own the file or
the directory; this is
called the _r_e_s_t_r_i_c_t_e_d _d_e_l_e_‐
_t_i_o_n _f_l_a_g for the direc‐
tory, and is commonly found
on world-writable directo‐
ries like //ttmmpp. For regu‐
lar files on some older
systems, the bit saves the
program's text image on the
swap device so it will load
more quickly when run; this
is called the _s_t_i_c_k_y _b_i_t.
OOPPTTIIOONNSS
Change the mode of each
FILE to MODE. With ----rreeff‐‐
eerreennccee, change the mode of
each FILE to that of RFILE.
--cc, ----cchhaannggeess
like verbose but
report only when a
change is made
--ff, ----ssiilleenntt, ----qquuiieett
suppress most error
messages
--vv, ----vveerrbboossee
output a diagnostic
for every file pro‐
cessed
----nnoo--pprreesseerrvvee--rroooott
do not treat '/'
specially (the
default)
----pprreesseerrvvee--rroooott
fail to operate
recursively on '/'
----rreeffeerreennccee=_R_F_I_L_E
use RFILE's mode
instead of MODE val‐
ues
--RR, ----rreeccuurrssiivvee
change files and
directories recur‐
sively
----hheellpp display this help
and exit
----vveerrssiioonn
output version
information and exit
Each MODE is of the form
'[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.
AAUUTTHHOORR
Written by David MacKenzie
and Jim Meyering.
RREEPPOORRTTIINNGG BBUUGGSS
GNU coreutils online help:
<http://www.gnu.org/soft‐
ware/coreutils/>
Report chmod translation
bugs to <http://transla‐
tionproject.org/team/>
CCOOPPYYRRIIGGHHTT
Copyright © 2016 Free Soft‐
ware Foundation, Inc.
License GPLv3+: GNU GPL
version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you
are free to change and
redistribute it. There is
NO WARRANTY, to the extent
permitted by law.
SSEEEE AALLSSOO
chmod(2)
Full documentation at:
<http://www.gnu.org/soft‐
ware/coreutils/chmod>
or available locally via:
info '(coreutils) chmod
invocation'
GNU coreutilFseb8r.u2a5ry 2017 CHMOD(1)