1 '\" te
   2 .\"  Copyright (c) 1992, X/Open Company Limited  All Rights Reserved  Portions Copyright (c) 2006, Sun Microsystems, Inc.  All Rights Reserved
   3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   4 .\" http://www.opengroup.org/bookstore/.
   5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions 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.
   6 .\"  This notice shall appear on any product containing this material.
   7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  10 .TH ID 1M "Sep 10, 2013"
  11 .SH NAME
  12 id \- return user identity
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 \fB/usr/bin/id\fR [\fB-p\fR] [\fIuser\fR]
  17 .fi
  18 
  19 .LP
  20 .nf
  21 \fB/usr/bin/id\fR \fB-a\fR [\fB-p\fR] [\fIuser\fR]
  22 .fi
  23 
  24 .LP
  25 .nf
  26 \fB/usr/bin/id\fR \fB-G\fR [\fB-n\fR] [\fIuser\fR]
  27 .fi
  28 
  29 .LP
  30 .nf
  31 \fB/usr/bin/id\fR \fB-g\fR [\fB-nr\fR] [\fIuser\fR]
  32 .fi
  33 
  34 .LP
  35 .nf
  36 \fB/usr/bin/id\fR \fB-u\fR [\fB-nr\fR] [\fIuser\fR]
  37 .fi
  38 
  39 .LP
  40 .nf
  41 \fB/usr/xpg4/bin/id\fR [\fB-p\fR] [\fIuser\fR]
  42 .fi
  43 
  44 .LP
  45 .nf
  46 \fB/usr/xpg4/bin/id\fR \fB-a\fR [\fB-p\fR] [\fIuser\fR]
  47 .fi
  48 
  49 .LP
  50 .nf
  51 \fB/usr/xpg4/bin/id\fR \fB-G\fR [\fB-n\fR] [\fIuser\fR]
  52 .fi
  53 
  54 .LP
  55 .nf
  56 \fB/usr/xpg4/bin/id\fR \fB-g\fR [\fB-nr\fR] [\fIuser\fR]
  57 .fi
  58 
  59 .LP
  60 .nf
  61 \fB/usr/xpg4/bin/id\fR \fB-u\fR [\fB-nr\fR] [\fIuser\fR]
  62 .fi
  63 
  64 .SH DESCRIPTION
  65 .sp
  66 .LP
  67 If no \fIuser\fR operand is provided, the \fBid\fR utility writes the user and
  68 group \fBID\fRs and the corresponding user and group names of the invoking
  69 process to standard output. If the effective and real \fBID\fRs do not match,
  70 both are written. If multiple groups are supported by the underlying system,
  71 \fB/usr/xpg4/bin/id\fR also writes the supplementary group affiliations of the
  72 invoking process.
  73 .sp
  74 .LP
  75 If a \fIuser\fR operand is provided and the process has the appropriate
  76 privileges, the user and group \fBID\fRs of the selected user are written. In
  77 this case, effective \fBID\fRs are assumed to be identical to real \fBID\fRs.
  78 If the selected user has more than one allowable group membership listed in the
  79 group database, \fB/usr/xpg4/bin/id\fR writes them in the same manner as the
  80 supplementary groups described in the preceding paragraph.
  81 .SS "Formats"
  82 .sp
  83 .LP
  84 The following formats are used when the \fBLC_MESSAGES\fR locale category
  85 specifies the "C" locale. In other locales, the strings \fBuid\fR, \fBgid\fR,
  86 \fBeuid\fR, \fBegid\fR, and \fBgroups\fR may be replaced with more appropriate
  87 strings corresponding to the locale.
  88 .sp
  89 .in +2
  90 .nf
  91 "uid=%u(%s) gid=%u(%s)\en" <\fIreal user ID\fR>, <\fIuser-name\fR>,
  92     <\fIreal group ID\fR>, <\fIgroup-name\fR>
  93 .fi
  94 .in -2
  95 .sp
  96 
  97 .sp
  98 .LP
  99 If the effective and real user \fBID\fRs do not match, the following are
 100 inserted immediately before the \fB\en\fR character in the previous format:
 101 .sp
 102 .in +2
 103 .nf
 104 " euid=%u(%s)"
 105 .fi
 106 .in -2
 107 .sp
 108 
 109 .sp
 110 .LP
 111 with the following arguments added at the end of the argument list:
 112 .sp
 113 .in +2
 114 .nf
 115 <\fIeffective user ID\fR>, <\fIeffective user-name\fR>
 116 .fi
 117 .in -2
 118 .sp
 119 
 120 .sp
 121 .LP
 122 If the effective and real group \fBID\fRs do not match, the following is
 123 inserted directly before the \fB\en\fR character in the format string (and
 124 after any addition resulting from the effective and real user \fBID\fRs not
 125 matching):
 126 .sp
 127 .in +2
 128 .nf
 129 " egid=%u(%s)"
 130 .fi
 131 .in -2
 132 .sp
 133 
 134 .sp
 135 .LP
 136 with the following arguments added at the end of the argument list:
 137 .sp
 138 .in +2
 139 .nf
 140 <\fIeffectivegroup-ID\fR>, <\fIeffectivegroupname\fR>
 141 .fi
 142 .in -2
 143 .sp
 144 
 145 .sp
 146 .LP
 147 If the process has supplementary group affiliations or the selected user is
 148 allowed to belong to multiple groups, the first is added directly before the
 149 \fBNEWLINE\fR character in the format string:
 150 .sp
 151 .in +2
 152 .nf
 153 " groups=%u(%s)"
 154 .fi
 155 .in -2
 156 .sp
 157 
 158 .sp
 159 .LP
 160 with the following arguments added at the end of the argument list:
 161 .sp
 162 .in +2
 163 .nf
 164 <\fIsupplementary group ID\fR>, <\fIsupplementary group name\fR>
 165 .fi
 166 .in -2
 167 .sp
 168 
 169 .sp
 170 .LP
 171 and the necessary number of the following added after that for any remaining
 172 supplementary group \fBID\fRs:
 173 .sp
 174 .in +2
 175 .nf
 176 ",%u(%s)"
 177 .fi
 178 .in -2
 179 .sp
 180 
 181 .sp
 182 .LP
 183 and the necessary number of the following arguments added at the end of the
 184 argument list:
 185 .sp
 186 .in +2
 187 .nf
 188 <\fIsupplementary group ID\fR>, <\fIsupplementary group name\fR>
 189 .fi
 190 .in -2
 191 .sp
 192 
 193 .sp
 194 .LP
 195 If any of the user \fBID\fR, group \fBID\fR, effective user \fBID\fR, effective
 196 group \fBID\fR or supplementary/multiple group \fBID\fRs cannot be mapped by
 197 the system into printable user or group names, the corresponding (\fB%s\fR) and
 198 name argument is omitted from the corresponding format string.
 199 .sp
 200 .LP
 201 When any of the options are specified, the output format is as described under
 202 OPTIONS.
 203 .SH OPTIONS
 204 .sp
 205 .LP
 206 The following options are supported by both \fB/usr/bin/id\fR and
 207 \fB/usr/xpg4/bin/id\fR. The \fB-p\fR and \fB-a\fR options are invalid if
 208 specified with any of the \fB-G\fR, \fB-g\fR, or \fB-u\fR options.
 209 .sp
 210 .ne 2
 211 .na
 212 \fB\fB-p\fR\fR
 213 .ad
 214 .RS 6n
 215 Reports additionally the current project membership of the invoking process.
 216 The project is reported using the            format:
 217 .sp
 218 .in +2
 219 .nf
 220 "projid=%u(%s)"
 221 .fi
 222 .in -2
 223 .sp
 224 
 225 which is inserted prior to the \fB\en\fR character of the default format
 226 described in the \fBFormats\fR section. The arguments
 227 .sp
 228 .in +2
 229 .nf
 230 <\fIproject ID\fR>,<\fIproject name\fR>
 231 .fi
 232 .in -2
 233 .sp
 234 
 235 are appended to the end of the argument list.  If the project \fBID\fR cannot
 236 be mapped by the system into a printable project name, the corresponding
 237 \fB(%s)\fR and name argument is omitted from the corresponding format string.
 238 .RE
 239 
 240 .sp
 241 .ne 2
 242 .na
 243 \fB\fB-a\fR\fR
 244 .ad
 245 .RS 6n
 246 Reports user name, user  \fBID\fR and all the groups to which the user belongs.
 247 .RE
 248 
 249 .sp
 250 .ne 2
 251 .na
 252 \fB\fB-G\fR\fR
 253 .ad
 254 .RS 6n
 255 Outputs all different group \fBID\fRs (effective, real and supplementary) only,
 256 using the format \fB"%u\en"\fR. If there is more than one distinct group
 257 affiliation, output each such affiliation, using the format \fB" %u"\fR, before
 258 the \fBNEWLINE\fR character is output.
 259 .RE
 260 
 261 .sp
 262 .ne 2
 263 .na
 264 \fB\fB-g\fR\fR
 265 .ad
 266 .RS 6n
 267 Outputs only the effective group \fBID\fR, using the format \fB"%u\en"\fR.
 268 .RE
 269 
 270 .sp
 271 .ne 2
 272 .na
 273 \fB\fB-n\fR\fR
 274 .ad
 275 .RS 6n
 276 Outputs the name in the format \fB"%s"\fR instead of the numeric \fBID\fR using
 277 the format \fB"%u"\fR.
 278 .RE
 279 
 280 .sp
 281 .ne 2
 282 .na
 283 \fB\fB-r\fR\fR
 284 .ad
 285 .RS 6n
 286 Outputs the real \fBID\fR instead of the effective \fBID\fR.
 287 .RE
 288 
 289 .sp
 290 .ne 2
 291 .na
 292 \fB\fB-u\fR\fR
 293 .ad
 294 .RS 6n
 295 Outputs only the effective user \fBID\fR, using the format \fB"%u\en"\fR.
 296 .RE
 297 
 298 .SH OPERANDS
 299 .sp
 300 .LP
 301 The following operand is supported:
 302 .sp
 303 .ne 2
 304 .na
 305 \fB\fIuser\fR\fR
 306 .ad
 307 .RS 8n
 308 The user (login) name for which information is to be written.
 309 .RE
 310 
 311 .SH ENVIRONMENT VARIABLES
 312 .sp
 313 .LP
 314 See \fBenviron\fR(5) for descriptions of the following environment variables
 315 that affect the execution of \fBid\fR: \fBLANG\fR, \fBLC_ALL\fR,
 316 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 317 .SH EXIT STATUS
 318 .sp
 319 .LP
 320 The following exit values are returned:
 321 .sp
 322 .ne 2
 323 .na
 324 \fB\fB0\fR\fR
 325 .ad
 326 .RS 6n
 327 Successful completion.
 328 .RE
 329 
 330 .sp
 331 .ne 2
 332 .na
 333 \fB\fB>0\fR\fR
 334 .ad
 335 .RS 6n
 336 An error occurred.
 337 .RE
 338 
 339 .SH ATTRIBUTES
 340 .sp
 341 .LP
 342 See \fBattributes\fR(5) for descriptions of the following attributes:
 343 .SS "/usr/bin/id"
 344 .sp
 345 
 346 .sp
 347 .TS
 348 box;
 349 c | c
 350 l | l .
 351 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 352 _
 353 Interface Stability     Stable
 354 .TE
 355 
 356 .SS "/usr/xpg4/bin/id"
 357 .sp
 358 
 359 .sp
 360 .TS
 361 box;
 362 c | c
 363 l | l .
 364 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 365 _
 366 Interface Stability     Standard
 367 .TE
 368 
 369 .SH SEE ALSO
 370 .sp
 371 .LP
 372 \fBfold\fR(1), \fBlogname\fR(1), \fBwho\fR(1), \fBgetgid\fR(2),
 373 \fBgetgroups\fR(2), \fBgetprojid\fR(2), \fBgetuid\fR(2), \fBattributes\fR(5),
 374 \fBenviron\fR(5), \fBstandards\fR(5)
 375 .SH NOTES
 376 .sp
 377 .LP
 378 Output produced by the \fB-G\fR option and by the default case could
 379 potentially produce very long lines on systems that support large numbers of
 380 supplementary groups.