logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

umask.1p (9448B)


  1. '\" et
  2. .TH UMASK "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. umask
  12. \(em get or set the file mode creation mask
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. umask \fB[\fR-S\fB] [\fImask\fB]\fR
  17. .fi
  18. .SH DESCRIPTION
  19. The
  20. .IR umask
  21. utility shall set the file mode creation mask of the current shell
  22. execution environment (see
  23. .IR "Section 2.12" ", " "Shell Execution Environment")
  24. to the value specified by the
  25. .IR mask
  26. operand. This mask shall affect the initial value of the file
  27. permission bits of subsequently created files. If
  28. .IR umask
  29. is called in a subshell or separate utility execution environment, such
  30. as one of the following:
  31. .sp
  32. .RS 4
  33. .nf
  34. (umask 002)
  35. nohup umask ...
  36. find . -exec umask ... \e;
  37. .fi
  38. .P
  39. .RE
  40. .P
  41. it shall not affect the file mode creation mask of the caller's
  42. environment.
  43. .P
  44. If the
  45. .IR mask
  46. operand is not specified, the
  47. .IR umask
  48. utility shall write to standard output the value of the
  49. file mode creation mask of the invoking process.
  50. .SH OPTIONS
  51. The
  52. .IR umask
  53. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  54. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  55. .P
  56. The following option shall be supported:
  57. .IP "\fB\-S\fP" 10
  58. Produce symbolic output.
  59. .P
  60. The default output style is unspecified, but shall be recognized on a
  61. subsequent invocation of
  62. .IR umask
  63. on the same system as a
  64. .IR mask
  65. operand to restore the previous file mode creation mask.
  66. .SH OPERANDS
  67. The following operand shall be supported:
  68. .IP "\fImask\fR" 10
  69. A string specifying the new file mode creation mask. The string is
  70. treated in the same way as the
  71. .IR mode
  72. operand described in the EXTENDED DESCRIPTION section for
  73. .IR chmod .
  74. .RS 10
  75. .P
  76. For a
  77. .IR symbolic_mode
  78. value, the new value of the file mode creation mask shall be the
  79. logical complement of the file permission bits portion of the file mode
  80. specified by the
  81. .IR symbolic_mode
  82. string.
  83. .P
  84. In a
  85. .IR symbolic_mode
  86. value, the permissions
  87. .IR op
  88. characters
  89. .BR '\(pl'
  90. and
  91. .BR '\-'
  92. shall be interpreted relative to the current file mode creation mask;
  93. .BR '\(pl'
  94. shall cause the bits for the indicated permissions to be cleared in the
  95. mask;
  96. .BR '\-'
  97. shall cause the bits for the indicated permissions to be set in the
  98. mask.
  99. .P
  100. The interpretation of
  101. .IR mode
  102. values that specify file mode bits other than the file permission bits
  103. is unspecified.
  104. .P
  105. In the octal integer form of
  106. .IR mode ,
  107. the specified bits are set in the file mode creation mask.
  108. .P
  109. The file mode creation mask shall be set to the resulting numeric
  110. value.
  111. .P
  112. The default output of a prior invocation of
  113. .IR umask
  114. on the same system with no operand also shall be recognized as a
  115. .IR mask
  116. operand.
  117. .RE
  118. .SH STDIN
  119. Not used.
  120. .SH "INPUT FILES"
  121. None.
  122. .SH "ENVIRONMENT VARIABLES"
  123. The following environment variables shall affect the execution of
  124. .IR umask :
  125. .IP "\fILANG\fP" 10
  126. Provide a default value for the internationalization variables that are
  127. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  128. .IR "Section 8.2" ", " "Internationalization Variables"
  129. for the precedence of internationalization variables used to determine
  130. the values of locale categories.)
  131. .IP "\fILC_ALL\fP" 10
  132. If set to a non-empty string value, override the values of all the
  133. other internationalization variables.
  134. .IP "\fILC_CTYPE\fP" 10
  135. Determine the locale for the interpretation of sequences of bytes of
  136. text data as characters (for example, single-byte as opposed to
  137. multi-byte characters in arguments).
  138. .IP "\fILC_MESSAGES\fP" 10
  139. .br
  140. Determine the locale that should be used to affect the format and
  141. contents of diagnostic messages written to standard error.
  142. .IP "\fINLSPATH\fP" 10
  143. Determine the location of message catalogs for the processing of
  144. .IR LC_MESSAGES .
  145. .SH "ASYNCHRONOUS EVENTS"
  146. Default.
  147. .SH STDOUT
  148. When the
  149. .IR mask
  150. operand is not specified, the
  151. .IR umask
  152. utility shall write a message to standard output that can later be used
  153. as a
  154. .IR umask
  155. .IR mask
  156. operand.
  157. .P
  158. If
  159. .BR \-S
  160. is specified, the message shall be in the following format:
  161. .sp
  162. .RS 4
  163. .nf
  164. "u=%s,g=%s,o=%s\en", <\fIowner permissions\fR>, <\fIgroup permissions\fR>,
  165. <\fIother permissions\fR>
  166. .fi
  167. .P
  168. .RE
  169. .P
  170. where the three values shall be combinations of letters from the set
  171. {\c
  172. .IR r ,
  173. .IR w ,
  174. .IR x };
  175. the presence of a letter shall indicate that the corresponding bit is
  176. clear in the file mode creation mask.
  177. .P
  178. If a
  179. .IR mask
  180. operand is specified, there shall be no output written to standard
  181. output.
  182. .SH STDERR
  183. The standard error shall be used only for diagnostic messages.
  184. .SH "OUTPUT FILES"
  185. None.
  186. .SH "EXTENDED DESCRIPTION"
  187. None.
  188. .SH "EXIT STATUS"
  189. The following exit values shall be returned:
  190. .IP "\00" 6
  191. The file mode creation mask was successfully changed, or no
  192. .IR mask
  193. operand was supplied.
  194. .IP >0 6
  195. An error occurred.
  196. .SH "CONSEQUENCES OF ERRORS"
  197. Default.
  198. .LP
  199. .IR "The following sections are informative."
  200. .SH "APPLICATION USAGE"
  201. Since
  202. .IR umask
  203. affects the current shell execution environment, it is generally
  204. provided as a shell regular built-in.
  205. .P
  206. In contrast to the negative permission logic provided by the file mode
  207. creation mask and the octal number form of the
  208. .IR mask
  209. argument, the symbolic form of the
  210. .IR mask
  211. argument specifies those permissions that are left alone.
  212. .SH EXAMPLES
  213. Either of the commands:
  214. .sp
  215. .RS 4
  216. .nf
  217. umask a=rx,ug+w
  218. .P
  219. umask 002
  220. .fi
  221. .P
  222. .RE
  223. .P
  224. sets the mode mask so that subsequently created files have their
  225. S_IWOTH bit cleared.
  226. .P
  227. After setting the mode mask with either of the above commands, the
  228. .IR umask
  229. command can be used to write out the current value of the mode mask:
  230. .sp
  231. .RS 4
  232. .nf
  233. \fB$ \fRumask
  234. \fB0002\fR
  235. .fi
  236. .P
  237. .RE
  238. .P
  239. (The output format is unspecified, but historical implementations use
  240. the octal integer mode format.)
  241. .sp
  242. .RS 4
  243. .nf
  244. \fB$ \fRumask -S
  245. \fBu=rwx,g=rwx,o=rx\fR
  246. .fi
  247. .P
  248. .RE
  249. .P
  250. Either of these outputs can be used as the mask operand to a subsequent
  251. invocation of the
  252. .IR umask
  253. utility.
  254. .P
  255. Assuming the mode mask is set as above, the command:
  256. .sp
  257. .RS 4
  258. .nf
  259. umask g-w
  260. .fi
  261. .P
  262. .RE
  263. .P
  264. sets the mode mask so that subsequently created files have their
  265. S_IWGRP and S_IWOTH bits cleared.
  266. .P
  267. The command:
  268. .sp
  269. .RS 4
  270. .nf
  271. umask -- -w
  272. .fi
  273. .P
  274. .RE
  275. .P
  276. sets the mode mask so that subsequently created files have all their
  277. write bits cleared. Note that
  278. .IR mask
  279. operands
  280. .BR \-r ,
  281. .BR \-w ,
  282. .BR \-x
  283. or anything beginning with a
  284. <hyphen-minus>,
  285. must be preceded by
  286. .BR \(dq--\(dq
  287. to keep it from being interpreted as an option.
  288. .SH RATIONALE
  289. Since
  290. .IR umask
  291. affects the current shell execution environment,
  292. it is generally provided as a shell regular built-in. If it is called
  293. in a subshell or separate utility execution environment, such as one of
  294. the following:
  295. .sp
  296. .RS 4
  297. .nf
  298. (umask 002)
  299. nohup umask ...
  300. find . -exec umask ... \e;
  301. .fi
  302. .P
  303. .RE
  304. .P
  305. it does not affect the file mode creation mask of the environment of
  306. the caller.
  307. .P
  308. The description of the historical utility was modified to allow it to
  309. use the symbolic modes of
  310. .IR chmod .
  311. The
  312. .BR \-s
  313. option used in early proposals was changed to
  314. .BR \-S
  315. because
  316. .BR \-s
  317. could be confused with a
  318. .IR symbolic_mode
  319. form of mask referring to the S_ISUID and S_ISGID bits.
  320. .P
  321. The default output style is unspecified to permit implementors to
  322. provide migration to the new symbolic style at the time most
  323. appropriate to their users. A
  324. .BR \-o
  325. flag to force octal mode output was omitted because the octal mode may
  326. not be sufficient to specify all of the information that may be present
  327. in the file mode creation mask when more secure file access permission
  328. checks are implemented.
  329. .P
  330. It has been suggested that trusted systems developers might appreciate
  331. ameliorating the requirement that the mode mask ``affects'' the file
  332. access permissions, since it seems access control lists might replace
  333. the mode mask to some degree. The wording has been changed to say that
  334. it affects the file permission bits, and it leaves the details of the
  335. behavior of how they affect the file access permissions to the
  336. description in the System Interfaces volume of POSIX.1\(hy2017.
  337. .SH "FUTURE DIRECTIONS"
  338. None.
  339. .SH "SEE ALSO"
  340. .IR "Chapter 2" ", " "Shell Command Language",
  341. .IR "\fIchmod\fR\^"
  342. .P
  343. The Base Definitions volume of POSIX.1\(hy2017,
  344. .IR "Chapter 8" ", " "Environment Variables",
  345. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  346. .P
  347. The System Interfaces volume of POSIX.1\(hy2017,
  348. .IR "\fIumask\fR\^(\|)"
  349. .\"
  350. .SH COPYRIGHT
  351. Portions of this text are reprinted and reproduced in electronic form
  352. from IEEE Std 1003.1-2017, Standard for Information Technology
  353. -- Portable Operating System Interface (POSIX), The Open Group Base
  354. Specifications Issue 7, 2018 Edition,
  355. Copyright (C) 2018 by the Institute of
  356. Electrical and Electronics Engineers, Inc and The Open Group.
  357. In the event of any discrepancy between this version and the original IEEE and
  358. The Open Group Standard, the original IEEE and The Open Group Standard
  359. is the referee document. The original Standard can be obtained online at
  360. http://www.opengroup.org/unix/online.html .
  361. .PP
  362. Any typographical or formatting errors that appear
  363. in this page are most likely
  364. to have been introduced during the conversion of the source files to
  365. man page format. To report such errors, see
  366. https://www.kernel.org/doc/man-pages/reporting_bugs.html .