File: umask.1p

package info (click to toggle)
manpages-posix 1.67-3
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 9,564 kB
  • ctags: 6
  • sloc: makefile: 69; sh: 37
file content (310 lines) | stat: -rw-r--r-- 8,912 bytes parent folder | download
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "UMASK" P 2003 POSIX
.\" umask 
.SH NAME
umask \- get or set the file mode creation mask
.SH SYNOPSIS
.LP
\fBumask\fP \fB[\fP\fB-S\fP\fB][\fP\fImask\fP\fB]\fP
.SH DESCRIPTION
.LP
The \fIumask\fP utility shall set the file mode creation mask of the
current shell execution environment (see \fIShell Execution Environment\fP
) to the value specified by the \fImask\fP operand. This mask
shall affect the initial value of the file permission bits of subsequently
created files. If \fIumask\fP is called in a subshell
or separate utility execution environment, such as one of the following:
.sp
.RS
.nf

\fB(umask 002)
nohup umask ...
find . -exec umask ... \\;
\fP
.fi
.RE
.LP
it shall not affect the file mode creation mask of the caller's environment.
.LP
If the \fImask\fP operand is not specified, the \fIumask\fP utility
shall write to standard output the value of the invoking
process' file mode creation mask.
.SH OPTIONS
.LP
The \fIumask\fP utility shall conform to the Base Definitions volume
of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
.LP
The following option shall be supported:
.TP 7
\fB-S\fP
Produce symbolic output.
.sp
.LP
The default output style is unspecified, but shall be recognized on
a subsequent invocation of \fIumask\fP on the same system
as a \fImask\fP operand to restore the previous file mode creation
mask.
.SH OPERANDS
.LP
The following operand shall be supported:
.TP 7
\fImask\fP
A string specifying the new file mode creation mask. The string is
treated in the same way as the \fImode\fP operand described
in the EXTENDED DESCRIPTION section for \fIchmod\fP. 
.LP
For a \fIsymbolic_mode\fP value, the new value of the file mode creation
mask shall be the logical complement of the file
permission bits portion of the file mode specified by the \fIsymbolic_mode\fP
string.
.LP
In a \fIsymbolic_mode\fP value, the permissions \fIop\fP characters
\fB'+'\fP and \fB'-'\fP shall be interpreted
relative to the current file mode creation mask; \fB'+'\fP shall cause
the bits for the indicated permissions to be cleared in
the mask; \fB'-'\fP shall cause the bits for the indicated permissions
to be set in the mask.
.LP
The interpretation of \fImode\fP values that specify file mode bits
other than the file permission bits is unspecified.
.LP
In the octal integer form of \fImode\fP, the specified bits are set
in the file mode creation mask.
.LP
The file mode creation mask shall be set to the resulting numeric
value.
.LP
The default output of a prior invocation of \fIumask\fP on the same
system with no operand also shall be recognized as a
\fImask\fP operand.
.sp
.SH STDIN
.LP
Not used.
.SH INPUT FILES
.LP
None.
.SH ENVIRONMENT VARIABLES
.LP
The following environment variables shall affect the execution of
\fIumask\fP:
.TP 7
\fILANG\fP
Provide a default value for the internationalization variables that
are unset or null. (See the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
for
the precedence of internationalization variables used to determine
the values of locale categories.)
.TP 7
\fILC_ALL\fP
If set to a non-empty string value, override the values of all the
other internationalization variables.
.TP 7
\fILC_CTYPE\fP
Determine the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments).
.TP 7
\fILC_MESSAGES\fP
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard
error.
.TP 7
\fINLSPATH\fP
Determine the location of message catalogs for the processing of \fILC_MESSAGES
\&.\fP 
.sp
.SH ASYNCHRONOUS EVENTS
.LP
Default.
.SH STDOUT
.LP
When the \fImask\fP operand is not specified, the \fIumask\fP utility
shall write a message to standard output that can later
be used as a \fIumask\fP \fImask\fP operand.
.LP
If \fB-S\fP is specified, the message shall be in the following format:
.sp
.RS
.nf

\fB"u=%s,g=%s,o=%s\\n", <\fP\fIowner permissions\fP\fB>, <\fP\fIgroup permissions\fP\fB>,
    <\fP\fIother permissions\fP\fB>
\fP
.fi
.RE
.LP
where the three values shall be combinations of letters from the set
{ \fIr\fP, \fIw\fP, \fIx\fP}; the presence of a letter
shall indicate that the corresponding bit is clear in the file mode
creation mask.
.LP
If a \fImask\fP operand is specified, there shall be no output written
to standard output.
.SH STDERR
.LP
The standard error shall be used only for diagnostic messages.
.SH OUTPUT FILES
.LP
None.
.SH EXTENDED DESCRIPTION
.LP
None.
.SH EXIT STATUS
.LP
The following exit values shall be returned:
.TP 7
\ 0
The file mode creation mask was successfully changed, or no \fImask\fP
operand was supplied.
.TP 7
>0
An error occurred.
.sp
.SH CONSEQUENCES OF ERRORS
.LP
Default.
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
Since \fIumask\fP affects the current shell execution environment,
it is generally provided as a shell regular built-in.
.LP
In contrast to the negative permission logic provided by the file
mode creation mask and the octal number form of the
\fImask\fP argument, the symbolic form of the \fImask\fP argument
specifies those permissions that are left alone.
.SH EXAMPLES
.LP
Either of the commands:
.sp
.RS
.nf

\fBumask a=rx,ug+w
.sp

umask 002
\fP
.fi
.RE
.LP
sets the mode mask so that subsequently created files have their S_IWOTH
bit cleared.
.LP
After setting the mode mask with either of the above commands, the
\fIumask\fP command can be used to write out the current
value of the mode mask:
.sp
.RS
.nf

\fB$\fP \fBumask
\fP\fB0002\fP
.fi
.RE
.LP
(The output format is unspecified, but historical implementations
use the octal integer mode format.)
.sp
.RS
.nf

\fB$\fP \fBumask -S
\fP\fBu=rwx,g=rwx,o=rx\fP
.fi
.RE
.LP
Either of these outputs can be used as the mask operand to a subsequent
invocation of the \fIumask\fP utility.
.LP
Assuming the mode mask is set as above, the command:
.sp
.RS
.nf

\fBumask g-w
\fP
.fi
.RE
.LP
sets the mode mask so that subsequently created files have their S_IWGRP
and S_IWOTH bits cleared.
.LP
The command:
.sp
.RS
.nf

\fBumask -- -w
\fP
.fi
.RE
.LP
sets the mode mask so that subsequently created files have all their
write bits cleared. Note that \fImask\fP operands
\fB-r\fP, \fB-w\fP, \fB-x\fP or anything beginning with a hyphen,
must be preceded by \fB"--"\fP to keep it from being
interpreted as an option.
.SH RATIONALE
.LP
Since \fIumask\fP affects the current shell execution environment,
it is generally provided as a shell regular built-in. If it
is called in a subshell or separate utility execution environment,
such as one of the following:
.sp
.RS
.nf

\fB(umask 002)
nohup umask ...
find . -exec umask ... \\;
\fP
.fi
.RE
.LP
it does not affect the file mode creation mask of the environment
of the caller.
.LP
The description of the historical utility was modified to allow it
to use the symbolic modes of \fIchmod\fP. The \fB-s\fP option used
in early proposals was changed to \fB-S\fP because \fB-s\fP
could be confused with a \fIsymbolic_mode\fP form of mask referring
to the S_ISUID and S_ISGID bits.
.LP
The default output style is implementation-defined to permit implementors
to provide migration to the new symbolic style at the
time most appropriate to their users. A \fB-o\fP flag to force octal
mode output was omitted because the octal mode may not be
sufficient to specify all of the information that may be present in
the file mode creation mask when more secure file access
permission checks are implemented.
.LP
It has been suggested that trusted systems developers might appreciate
ameliorating the requirement that the mode mask
"affects" the file access permissions, since it seems access control
lists might replace the mode mask to some degree. The
wording has been changed to say that it affects the file permission
bits, and it leaves the details of the behavior of how they
affect the file access permissions to the description in the System
Interfaces volume of IEEE\ Std\ 1003.1-2001.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIShell Command Language\fP , \fIchmod\fP , the System
Interfaces volume of IEEE\ Std\ 1003.1-2001, \fIumask\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .