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

id.1p (9153B)


  1. '\" et
  2. .TH ID "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. id
  12. \(em return user identity
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. id \fB[\fIuser\fB]\fR
  17. .P
  18. id -G \fB[\fR-n\fB] [\fIuser\fB]\fR
  19. .P
  20. id -g \fB[\fR-nr\fB] [\fIuser\fB]\fR
  21. .P
  22. id -u \fB[\fR-nr\fB] [\fIuser\fB]\fR
  23. .fi
  24. .SH DESCRIPTION
  25. If no
  26. .IR user
  27. operand is provided, the
  28. .IR id
  29. utility shall write the user and group IDs and the corresponding user
  30. and group names of the invoking process to standard output. If the
  31. effective and real IDs do not match, both shall be written. If
  32. multiple groups are supported by the underlying system (see the
  33. description of
  34. {NGROUPS_MAX}
  35. in the System Interfaces volume of POSIX.1\(hy2017), the supplementary group affiliations of the invoking
  36. process shall also be written.
  37. .P
  38. If a
  39. .IR user
  40. operand is provided and the process has appropriate privileges, the
  41. user and group IDs of the selected user shall be written. In this
  42. case, effective IDs shall be assumed to be identical to real IDs. If
  43. the selected user has more than one allowable group membership listed
  44. in the group database, these shall be written in the same manner as the
  45. supplementary groups described in the preceding paragraph.
  46. .SH OPTIONS
  47. The
  48. .IR id
  49. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  50. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  51. .P
  52. The following options shall be supported:
  53. .IP "\fB\-G\fP" 10
  54. Output all different group IDs (effective, real, and supplementary)
  55. only, using the format
  56. .BR \(dq%u\en\(dq .
  57. If there is more than one distinct group affiliation, output each such
  58. affiliation, using the format
  59. .BR \(dq\ %u\(dq ,
  60. before the
  61. <newline>
  62. is output.
  63. .IP "\fB\-g\fP" 10
  64. Output only the effective group ID, using the format
  65. .BR \(dq%u\en\(dq .
  66. .IP "\fB\-n\fP" 10
  67. Output the name in the format
  68. .BR \(dq%s\(dq
  69. instead of the numeric ID using the format
  70. .BR \(dq%u\(dq .
  71. .IP "\fB\-r\fP" 10
  72. Output the real ID instead of the effective ID.
  73. .IP "\fB\-u\fP" 10
  74. Output only the effective user ID, using the format
  75. .BR \(dq%u\en\(dq .
  76. .SH OPERANDS
  77. The following operand shall be supported:
  78. .IP "\fIuser\fR" 10
  79. The login name for which information is to be written.
  80. .SH STDIN
  81. Not used.
  82. .SH "INPUT FILES"
  83. None.
  84. .SH "ENVIRONMENT VARIABLES"
  85. The following environment variables shall affect the execution of
  86. .IR id :
  87. .IP "\fILANG\fP" 10
  88. Provide a default value for the internationalization variables that are
  89. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  90. .IR "Section 8.2" ", " "Internationalization Variables"
  91. for the precedence of internationalization variables used to determine
  92. the values of locale categories.)
  93. .IP "\fILC_ALL\fP" 10
  94. If set to a non-empty string value, override the values of all the
  95. other internationalization variables.
  96. .IP "\fILC_CTYPE\fP" 10
  97. Determine the locale for the interpretation of sequences of bytes of
  98. text data as characters (for example, single-byte as opposed to
  99. multi-byte characters in arguments).
  100. .IP "\fILC_MESSAGES\fP" 10
  101. .br
  102. Determine the locale that should be used to affect the format and
  103. contents of diagnostic messages written to standard error and
  104. informative messages written to standard output.
  105. .IP "\fINLSPATH\fP" 10
  106. Determine the location of message catalogs for the processing of
  107. .IR LC_MESSAGES .
  108. .SH "ASYNCHRONOUS EVENTS"
  109. Default.
  110. .SH STDOUT
  111. The following formats shall be used when the
  112. .IR LC_MESSAGES
  113. locale category specifies the POSIX locale. In other locales, the
  114. strings
  115. .IR uid ,
  116. .IR gid ,
  117. .IR euid ,
  118. .IR egid ,
  119. and
  120. .IR groups
  121. may be replaced with more appropriate strings corresponding to the
  122. locale.
  123. .sp
  124. .RS 4
  125. .nf
  126. "uid=%u(%s) gid=%u(%s)\en", <\fIreal user ID\fR>, <\fIuser-name\fR>,
  127. <\fIreal group ID\fR>, <\fIgroup-name\fR>
  128. .fi
  129. .P
  130. .RE
  131. .P
  132. If the effective and real user IDs do not match, the following shall be
  133. inserted immediately before the
  134. .BR '\en'
  135. character in the previous format:
  136. .sp
  137. .RS 4
  138. .nf
  139. " euid=%u(%s)"
  140. .fi
  141. .P
  142. .RE
  143. .P
  144. with the following arguments added at the end of the argument list:
  145. .sp
  146. .RS 4
  147. .nf
  148. <\fIeffective user ID\fR>, <\fIeffective user-name\fR>
  149. .fi
  150. .P
  151. .RE
  152. .P
  153. If the effective and real group IDs do not match, the following shall
  154. be inserted directly before the
  155. .BR '\en'
  156. character in the format string (and after any addition resulting from
  157. the effective and real user IDs not matching):
  158. .sp
  159. .RS 4
  160. .nf
  161. " egid=%u(%s)"
  162. .fi
  163. .P
  164. .RE
  165. .P
  166. with the following arguments added at the end of the argument list:
  167. .sp
  168. .RS 4
  169. .nf
  170. <\fIeffective group-ID\fR>, <\fIeffective group name\fR>
  171. .fi
  172. .P
  173. .RE
  174. .P
  175. If the process has supplementary group affiliations or the selected
  176. user is allowed to belong to multiple groups, the first shall be added
  177. directly before the
  178. <newline>
  179. in the format string:
  180. .sp
  181. .RS 4
  182. .nf
  183. " groups=%u(%s)"
  184. .fi
  185. .P
  186. .RE
  187. .P
  188. with the following arguments added at the end of the argument list:
  189. .sp
  190. .RS 4
  191. .nf
  192. <\fIsupplementary group ID\fR>, <\fIsupplementary group name\fR>
  193. .fi
  194. .P
  195. .RE
  196. .P
  197. and the necessary number of the following added after that for any
  198. remaining supplementary group IDs:
  199. .sp
  200. .RS 4
  201. .nf
  202. ",%u(%s)"
  203. .fi
  204. .P
  205. .RE
  206. .P
  207. and the necessary number of the following arguments added at the end of
  208. the argument list:
  209. .sp
  210. .RS 4
  211. .nf
  212. <\fIsupplementary group ID\fR>, <\fIsupplementary group name\fR>
  213. .fi
  214. .P
  215. .RE
  216. .P
  217. If any of the user ID, group ID, effective user ID, effective group ID,
  218. or supplementary/multiple group IDs cannot be mapped by the system into
  219. printable user or group names, the corresponding
  220. .BR \(dq(%s)\(dq
  221. and
  222. .IR name
  223. argument shall be omitted from the corresponding format string.
  224. .P
  225. When any of the options are specified, the output format shall be as
  226. described in the OPTIONS section.
  227. .SH STDERR
  228. The standard error shall be used only for diagnostic messages.
  229. .SH "OUTPUT FILES"
  230. None.
  231. .SH "EXTENDED DESCRIPTION"
  232. None.
  233. .SH "EXIT STATUS"
  234. The following exit values shall be returned:
  235. .IP "\00" 6
  236. Successful completion.
  237. .IP >0 6
  238. An error occurred.
  239. .SH "CONSEQUENCES OF ERRORS"
  240. Default.
  241. .LP
  242. .IR "The following sections are informative."
  243. .SH "APPLICATION USAGE"
  244. Output produced by the
  245. .BR \-G
  246. option and by the default case could potentially produce very long
  247. lines on systems that support large numbers of supplementary groups.
  248. (On systems with user and group IDs that are 32-bit integers and with
  249. group names with a maximum of 8 bytes per name, 93 supplementary groups
  250. plus distinct effective and real group and user IDs could theoretically
  251. overflow the 2\|048-byte
  252. {LINE_MAX}
  253. text file line limit on the default output case. It would take about
  254. 186 supplementary groups to overflow the 2\|048-byte barrier using
  255. .IR id
  256. .BR \-G ).
  257. This is not expected to be a problem in practice, but in cases where it
  258. is a concern, applications should consider using
  259. .IR fold
  260. .BR \-s
  261. before post-processing the output of
  262. .IR id .
  263. .SH EXAMPLES
  264. None.
  265. .SH RATIONALE
  266. The functionality provided by the 4 BSD
  267. .IR groups
  268. utility can be simulated using:
  269. .sp
  270. .RS 4
  271. .nf
  272. id -Gn [ user ]
  273. .fi
  274. .P
  275. .RE
  276. .P
  277. The 4 BSD command
  278. .IR groups
  279. was considered, but it was not included because it did not provide the
  280. functionality of the
  281. .IR id
  282. utility of the SVID. Also, it was thought that it would be easier to
  283. modify
  284. .IR id
  285. to provide the additional functionality necessary to systems with
  286. multiple groups than to invent another command.
  287. .P
  288. The options
  289. .BR \-u ,
  290. .BR \-g ,
  291. .BR \-n ,
  292. and
  293. .BR \-r
  294. were added to ease the use of
  295. .IR id
  296. with shell commands substitution. Without these options it is
  297. necessary to use some preprocessor such as
  298. .IR sed
  299. to select the desired piece of information. Since output such as that
  300. produced by:
  301. .sp
  302. .RS 4
  303. .nf
  304. id -u -n
  305. .fi
  306. .P
  307. .RE
  308. .P
  309. is frequently wanted, it seemed desirable to add the options.
  310. .SH "FUTURE DIRECTIONS"
  311. None.
  312. .SH "SEE ALSO"
  313. .IR "\fIfold\fR\^",
  314. .IR "\fIlogname\fR\^",
  315. .IR "\fIwho\fR\^"
  316. .P
  317. The Base Definitions volume of POSIX.1\(hy2017,
  318. .IR "Chapter 8" ", " "Environment Variables",
  319. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  320. .P
  321. The System Interfaces volume of POSIX.1\(hy2017,
  322. .IR "\fIgetgid\fR\^(\|)",
  323. .IR "\fIgetgroups\fR\^(\|)",
  324. .IR "\fIgetuid\fR\^(\|)"
  325. .\"
  326. .SH COPYRIGHT
  327. Portions of this text are reprinted and reproduced in electronic form
  328. from IEEE Std 1003.1-2017, Standard for Information Technology
  329. -- Portable Operating System Interface (POSIX), The Open Group Base
  330. Specifications Issue 7, 2018 Edition,
  331. Copyright (C) 2018 by the Institute of
  332. Electrical and Electronics Engineers, Inc and The Open Group.
  333. In the event of any discrepancy between this version and the original IEEE and
  334. The Open Group Standard, the original IEEE and The Open Group Standard
  335. is the referee document. The original Standard can be obtained online at
  336. http://www.opengroup.org/unix/online.html .
  337. .PP
  338. Any typographical or formatting errors that appear
  339. in this page are most likely
  340. to have been introduced during the conversion of the source files to
  341. man page format. To report such errors, see
  342. https://www.kernel.org/doc/man-pages/reporting_bugs.html .