Annotation of src/usr.bin/id/id.1, Revision 1.18
1.18 ! millert 1: .\" $OpenBSD: id.1,v 1.17 2010/09/03 11:09:29 jmc Exp $
1.1 deraadt 2: .\" $NetBSD: id.1,v 1.5 1995/09/28 08:05:40 perry Exp $
3: .\"
4: .\" Copyright (c) 1991, 1993, 1994
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" the Institute of Electrical and Electronics Engineers, Inc.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
1.10 millert 18: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)id.1 8.2 (Berkeley) 5/5/94
35: .\"
1.18 ! millert 36: .Dd $Mdocdate: September 3 2010 $
1.1 deraadt 37: .Dt ID 1
1.5 aaron 38: .Os
1.1 deraadt 39: .Sh NAME
40: .Nm id
41: .Nd return user identity
42: .Sh SYNOPSIS
43: .Nm id
44: .Op Ar user
45: .Nm id
1.18 ! millert 46: .Fl c
! 47: .Op Ar user
! 48: .Nm id
1.1 deraadt 49: .Fl G Op Fl n
50: .Op Ar user
51: .Nm id
52: .Fl g Op Fl nr
53: .Op Ar user
54: .Nm id
55: .Fl p
1.12 jmc 56: .Op Ar user
1.1 deraadt 57: .Nm id
58: .Fl u Op Fl nr
59: .Op Ar user
60: .Sh DESCRIPTION
61: The
1.7 aaron 62: .Nm
1.1 deraadt 63: utility displays the user and group names and numeric IDs, of the
64: calling process, to the standard output.
65: If the real and effective IDs are different, both are displayed,
66: otherwise only the real ID is displayed.
67: .Pp
68: If a
69: .Ar user
70: (login name or user ID)
71: is specified, the user and group IDs of that user are displayed.
72: In this case, the real and effective IDs are assumed to be the same.
73: .Pp
74: The options are as follows:
75: .Bl -tag -width Ds
1.18 ! millert 76: .It Fl c
! 77: Display the login class of the real user ID or the specified
! 78: .Ar user .
1.1 deraadt 79: .It Fl G
80: Display the different group IDs (effective, real and supplementary)
1.8 aaron 81: as whitespace separated numbers, in no particular order.
1.1 deraadt 82: .It Fl g
83: Display the effective group ID as a number.
84: .It Fl n
85: Display the name of the user or group ID for the
86: .Fl G ,
87: .Fl g
88: and
89: .Fl u
90: options instead of the number.
91: If any of the ID numbers cannot be mapped into names, the number will be
92: displayed as usual.
93: .It Fl p
94: Make the output human-readable.
95: If the user name returned by
96: .Xr getlogin 2
97: is different from the login name referenced by the user ID, the name
98: returned by
99: .Xr getlogin 2
1.9 aaron 100: is displayed, preceded by the keyword
101: .Dq login .
102: The user ID as a name is displayed, preceded by the keyword
103: .Dq uid .
1.1 deraadt 104: If the effective user ID is different from the real user ID, the real user
1.9 aaron 105: ID is displayed as a name, preceded by the keyword
106: .Dq euid .
1.1 deraadt 107: If the effective group ID is different from the real group ID, the real group
1.9 aaron 108: ID is displayed as a name, preceded by the keyword
109: .Dq rgid .
1.1 deraadt 110: The list of groups to which the user belongs is then displayed as names,
1.9 aaron 111: preceded by the keyword
112: .Dq groups .
1.18 ! millert 113: If there is a login class specified for the user in the
! 114: .Xr passwd 5
! 115: database, it is displayed, preceded by the keyword
! 116: .Dq class .
1.1 deraadt 117: Each display is on a separate line.
118: .It Fl r
119: Display the real ID for the
120: .Fl g
121: and
122: .Fl u
123: options instead of the effective ID.
124: .It Fl u
125: Display the effective user ID as a number.
126: .El
1.17 jmc 127: .Sh EXIT STATUS
1.15 sobrado 128: .Ex -std id
1.1 deraadt 129: .Sh SEE ALSO
1.18 ! millert 130: .Xr who 1 ,
! 131: .Xr login.conf 5
1.1 deraadt 132: .Sh STANDARDS
133: The
1.7 aaron 134: .Nm
1.13 jmc 135: utility is compliant with the
1.16 jmc 136: .St -p1003.1-2008
1.13 jmc 137: specification.
138: .Pp
1.18 ! millert 139: The flags
! 140: .Op Fl cp
! 141: are extensions to that specification.
1.1 deraadt 142: .Sh HISTORY
143: The
144: historic
145: .Xr groups 1
146: command is equivalent to
1.9 aaron 147: .Ic id Fl Gn Op Ar user .
1.1 deraadt 148: .Pp
149: The
150: historic
151: .Xr whoami 1
152: command is equivalent to
1.11 jmc 153: .Ic id Fl un .
1.1 deraadt 154: .Pp
155: The
1.7 aaron 156: .Nm
1.1 deraadt 157: command first appeared in
158: .Bx 4.4 .