diff options
Diffstat (limited to 'man1p/id.1p')
-rw-r--r-- | man1p/id.1p | 323 |
1 files changed, 323 insertions, 0 deletions
diff --git a/man1p/id.1p b/man1p/id.1p new file mode 100644 index 000000000..ed9df18bb --- /dev/null +++ b/man1p/id.1p @@ -0,0 +1,323 @@ +.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved +.TH "ID" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" +.\" id +.SH NAME +id \- return user identity +.SH SYNOPSIS +.LP +\fBid\fP \fB[\fP\fIuser\fP\fB]\fP\fB +.br +.sp +id -G\fP\fB[\fP\fB-n\fP\fB] [\fP\fIuser\fP\fB]\fP\fB +.br +.sp +id -g\fP\fB[\fP\fB-nr\fP\fB] [\fP\fIuser\fP\fB]\fP\fB +.br +.sp +id -u\fP\fB[\fP\fB-nr\fP\fB] [\fP\fIuser\fP\fB]\fP\fB +.br +\fP +.SH DESCRIPTION +.LP +If no \fIuser\fP operand is provided, the \fIid\fP utility shall write +the user and group IDs and the corresponding user and +group names of the invoking process to standard output. If the effective +and real IDs do not match, both shall be written. If +multiple groups are supported by the underlying system (see the description +of {NGROUPS_MAX} in the System Interfaces volume of +IEEE\ Std\ 1003.1-2001), the supplementary group affiliations of the +invoking process shall also be written. +.LP +If a \fIuser\fP operand is provided and the process has the appropriate +privileges, the user and group IDs of the selected user +shall be written. In this case, effective IDs shall be assumed to +be identical to real IDs. If the selected user has more than one +allowable group membership listed in the group database, these shall +be written in the same manner as the supplementary groups +described in the preceding paragraph. +.SH OPTIONS +.LP +The \fIid\fP utility shall conform to the Base Definitions volume +of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines. +.LP +The following options shall be supported: +.TP 7 +\fB-G\fP +Output all different group IDs (effective, real, and supplementary) +only, using the format \fB"%u\\n"\fP . If there is more +than one distinct group affiliation, output each such affiliation, +using the format \fB"\ %u"\fP , before the +<newline> is output. +.TP 7 +\fB-g\fP +Output only the effective group ID, using the format \fB"%u\\n"\fP +\&. +.TP 7 +\fB-n\fP +Output the name in the format \fB"%s"\fP instead of the numeric ID +using the format \fB"%u"\fP . +.TP 7 +\fB-r\fP +Output the real ID instead of the effective ID. +.TP 7 +\fB-u\fP +Output only the effective user ID, using the format \fB"%u\\n"\fP +\&. +.sp +.SH OPERANDS +.LP +The following operand shall be supported: +.TP 7 +\fIuser\fP +The login name for which information is to be written. +.sp +.SH STDIN +.LP +Not used. +.SH INPUT FILES +.LP +None. +.SH ENVIRONMENT VARIABLES +.LP +The following environment variables shall affect the execution of +\fIid\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 and +informative messages written to standard output. +.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 +The following formats shall be used when the \fILC_MESSAGES\fP locale +category specifies the POSIX locale. In other locales, +the strings \fIuid\fP, \fIgid\fP, \fIeuid\fP, \fIegid\fP, and \fIgroups\fP +may be replaced with more appropriate strings +corresponding to the locale. +.sp +.RS +.nf + +\fB"uid=%u(%s) gid=%u(%s)\\n", <\fP\fIreal user ID\fP\fB>, <\fP\fIuser-name\fP\fB>, + <\fP\fIreal group ID\fP\fB>, <\fP\fIgroup-name\fP\fB> +\fP +.fi +.RE +.LP +If the effective and real user IDs do not match, the following shall +be inserted immediately before the \fB'\\n'\fP character +in the previous format: +.sp +.RS +.nf + +\fB" euid=%u(%s)" +\fP +.fi +.RE +.LP +with the following arguments added at the end of the argument list: +.sp +.RS +.nf + +\fB<\fP\fIeffective user ID\fP\fB>, <\fP\fIeffective user-name\fP\fB> +\fP +.fi +.RE +.LP +If the effective and real group IDs do not match, the following shall +be inserted directly before the \fB'\\n'\fP character in +the format string (and after any addition resulting from the effective +and real user IDs not matching): +.sp +.RS +.nf + +\fB" egid=%u(%s)" +\fP +.fi +.RE +.LP +with the following arguments added at the end of the argument list: +.sp +.RS +.nf + +\fB<\fP\fIeffective group-ID\fP\fB>, <\fP\fIeffective group name\fP\fB> +\fP +.fi +.RE +.LP +If the process has supplementary group affiliations or the selected +user is allowed to belong to multiple groups, the first +shall be added directly before the <newline> in the format string: +.sp +.RS +.nf + +\fB" groups=%u(%s)" +\fP +.fi +.RE +.LP +with the following arguments added at the end of the argument list: +.sp +.RS +.nf + +\fB<\fP\fIsupplementary group ID\fP\fB>, <\fP\fIsupplementary group name\fP\fB> +\fP +.fi +.RE +.LP +and the necessary number of the following added after that for any +remaining supplementary group IDs: +.sp +.RS +.nf + +\fB",%u(%s)" +\fP +.fi +.RE +.LP +and the necessary number of the following arguments added at the end +of the argument list: +.sp +.RS +.nf + +\fB<\fP\fIsupplementary group ID\fP\fB>, <\fP\fIsupplementary group name\fP\fB> +\fP +.fi +.RE +.LP +If any of the user ID, group ID, effective user ID, effective group +ID, or supplementary/multiple group IDs cannot be mapped by +the system into printable user or group names, the corresponding \fB"(%s)"\fP +and \fIname\fP argument shall be omitted from the +corresponding format string. +.LP +When any of the options are specified, the output format shall be +as described in the OPTIONS section. +.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 +Successful completion. +.TP 7 +>0 +An error occurred. +.sp +.SH CONSEQUENCES OF ERRORS +.LP +Default. +.LP +\fIThe following sections are informative.\fP +.SH APPLICATION USAGE +.LP +Output produced by the \fB-G\fP option and by the default case could +potentially produce very long lines on systems that +support large numbers of supplementary groups. (On systems with user +and group IDs that are 32-bit integers and with group names +with a maximum of 8 bytes per name, 93 supplementary groups plus distinct +effective and real group and user IDs could theoretically +overflow the 2048-byte {LINE_MAX} text file line limit on the default +output case. It would take about 186 supplementary groups to +overflow the 2048-byte barrier using \fIid\fP \fB-G\fP). This is not +expected to be a problem in practice, but in cases where it +is a concern, applications should consider using \fIfold\fP \fB-s\fP +before postprocessing +the output of \fIid\fP. +.SH EXAMPLES +.LP +None. +.SH RATIONALE +.LP +The functionality provided by the 4 BSD \fIgroups\fP utility can be +simulated using: +.sp +.RS +.nf + +\fBid -Gn [ user ] +\fP +.fi +.RE +.LP +The 4 BSD command \fIgroups\fP was considered, but it was not included +because it did not provide the functionality of the +\fIid\fP utility of the SVID. Also, it was thought that it would be +easier to modify \fIid\fP to provide the additional +functionality necessary to systems with multiple groups than to invent +another command. +.LP +The options \fB-u\fP, \fB-g\fP, \fB-n\fP, and \fB-r\fP were added +to ease the use of \fIid\fP with shell commands +substitution. Without these options it is necessary to use some preprocessor +such as \fIsed\fP +to select the desired piece of information. Since output such as that +produced by: +.sp +.RS +.nf + +\fBid -u -n +\fP +.fi +.RE +.LP +is frequently wanted, it seemed desirable to add the options. +.SH FUTURE DIRECTIONS +.LP +None. +.SH SEE ALSO +.LP +\fIfold\fP , \fIlogname\fP , \fIwho\fP , the System +Interfaces volume of IEEE\ Std\ 1003.1-2001, \fIgetgid\fP(), \fIgetgroups\fP(), +\fIgetuid\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 . |