1id(1M)                  System Administration Commands                  id(1M)
2
3
4

NAME

6       id - return user identity
7

SYNOPSIS

9       /usr/bin/id [-p] [user]
10
11
12       /usr/bin/id -a [-p] [user]
13
14
15       /usr/bin/id -G [-n] [user]
16
17
18       /usr/bin/id -g [-nr] [user]
19
20
21       /usr/bin/id -u [-nr] [user]
22
23
24       /usr/xpg4/bin/id [-p] [user]
25
26
27       /usr/xpg4/bin/id -a [-p] [user]
28
29
30       /usr/xpg4/bin/id -G [-n] [user]
31
32
33       /usr/xpg4/bin/id -g [-nr] [user]
34
35
36       /usr/xpg4/bin/id -u [-nr] [user]
37
38

DESCRIPTION

40       If  no  user  operand  is  provided, the id utility writes the user and
41       group IDs and the corresponding user and group names  of  the  invoking
42       process to standard output. If the effective and real IDs do not match,
43       both are written. If multiple groups are supported  by  the  underlying
44       system,  /usr/xpg4/bin/id  also writes the supplementary group affilia‐
45       tions of the invoking process.
46
47
48       If a user operand is provided and the process has the appropriate priv‐
49       ileges,  the  user  and  group IDs of the selected user are written. In
50       this case, effective IDs are assumed to be identical to  real  IDs.  If
51       the  selected  user has more than one allowable group membership listed
52       in the group database, /usr/xpg4/bin/id writes them in the same  manner
53       as the supplementary groups described in the preceding paragraph.
54
55   Formats
56       The  following  formats  are  used when the LC_MESSAGES locale category
57       specifies the "C" locale. In other locales, the strings uid, gid, euid,
58       egid,  and  groups may be replaced with more appropriate strings corre‐
59       sponding to the locale.
60
61         "uid=%u(%s) gid=%u(%s)\n" <real user ID>, <user-name>,
62             <real group ID>, <group-name>
63
64
65
66
67       If the effective and real user IDs do  not  match,  the  following  are
68       inserted immediately before the \n character in the previous format:
69
70         " euid=%u(%s)"
71
72
73
74
75       with the following arguments added at the end of the argument list:
76
77         <effective user ID>, <effective user-name>
78
79
80
81
82       If  the  effective  and  real  group IDs do not match, the following is
83       inserted directly before the \n character in  the  format  string  (and
84       after  any  addition resulting from the effective and real user IDs not
85       matching):
86
87         " egid=%u(%s)"
88
89
90
91
92       with the following arguments added at the end of the argument list:
93
94         <effectivegroup-ID>, <effectivegroupname>
95
96
97
98
99       If the process has supplementary group  affiliations  or  the  selected
100       user  is  allowed  to  belong  to  multiple  groups, the first is added
101       directly before the NEWLINE character in the format string:
102
103         " groups=%u(%s)"
104
105
106
107
108       with the following arguments added at the end of the argument list:
109
110         <supplementary group ID>, <supplementary group name>
111
112
113
114
115       and the necessary number of the following  added  after  that  for  any
116       remaining supplementary group IDs:
117
118         ",%u(%s)"
119
120
121
122
123       and the necessary number of the following arguments added at the end of
124       the argument list:
125
126         <supplementary group ID>, <supplementary group name>
127
128
129
130
131       If any of the user ID, group ID, effective user ID, effective group  ID
132       or supplementary/multiple group IDs cannot be mapped by the system into
133       printable user or group names, the corresponding (%s) and name argument
134       is omitted from the corresponding format string.
135
136
137       When  any  of  the  options  are  specified,  the  output  format is as
138       described under OPTIONS.
139

OPTIONS

141       The  following  options  are  supported   by   both   /usr/bin/id   and
142       /usr/xpg4/bin/id.  The  -p and -a options are invalid if specified with
143       any of the -G, -g, or -u options.
144
145       -p    Reports additionally the current project membership of the invok‐
146             ing process. The project is reported using the            format:
147
148               "projid=%u(%s)"
149
150
151             which  is inserted prior to the 0fR character of the default for‐
152             mat described in the Formats section. The arguments
153
154               <project ID>,<project name>
155
156
157             are appended to the end of the argument list.  If the project  ID
158             cannot be mapped by the system into a printable project name, the
159             corresponding (%s) and name argument is omitted from  the  corre‐
160             sponding format string.
161
162
163       -a    Reports  user name, user  ID and all the groups to which the user
164             belongs.
165
166
167       -G    Outputs all different group IDs (effective, real  and  supplemen‐
168             tary)  only,  using  the format "%u\n". If there is more than one
169             distinct group affiliation, output each such  affiliation,  using
170             the format " %u", before the NEWLINE character is output.
171
172
173       -g    Outputs only the effective group ID, using the format "%u\n".
174
175
176       -n    Outputs  the  name  in  the format "%s" instead of the numeric ID
177             using the format "%u".
178
179
180       -r    Outputs the real ID instead of the effective ID.
181
182
183       -u    Outputs only the effective user ID, using the format "%u\n".
184
185

OPERANDS

187       The following operand is supported:
188
189       user    The user (login) name for which information is to be written.
190
191

ENVIRONMENT VARIABLES

193       See environ(5) for descriptions of the following environment  variables
194       that  affect  the execution of id: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
195       and NLSPATH.
196

EXIT STATUS

198       The following exit values are returned:
199
200       0     Successful completion.
201
202
203       >0    An error occurred.
204
205

ATTRIBUTES

207       See attributes(5) for descriptions of the following attributes:
208
209   /usr/bin/id
210       ┌─────────────────────────────┬─────────────────────────────┐
211       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
212       ├─────────────────────────────┼─────────────────────────────┤
213       │Availability                 │SUNWcsu, SUNWcar             │
214       ├─────────────────────────────┼─────────────────────────────┤
215       │Interface Stability          │Stable                       │
216       └─────────────────────────────┴─────────────────────────────┘
217
218   /usr/xpg4/bin/id
219       ┌─────────────────────────────┬─────────────────────────────┐
220       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
221       ├─────────────────────────────┼─────────────────────────────┤
222       │Availability                 │SUNWxcu4                     │
223       ├─────────────────────────────┼─────────────────────────────┤
224       │Interface Stability          │Standard                     │
225       └─────────────────────────────┴─────────────────────────────┘
226

SEE ALSO

228       fold(1), logname(1),  who(1),  getgid(2),  getgroups(2),  getprojid(2),
229       getuid(2), attributes(5), environ(5), standards(5)
230

NOTES

232       Output  produced  by the -G option and by the default case could poten‐
233       tially produce very long lines on systems that support large numbers of
234       supplementary groups.
235
236
237
238SunOS 5.11                        28 Nov 2006                           id(1M)
Impressum