Annotation of src/usr.bin/id/id.1, Revision 1.9
1.9 ! aaron 1: .\" $OpenBSD: id.1,v 1.8 2000/03/04 22:19:23 aaron 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.
18: .\" 3. All advertising materials mentioning features or use of this software
19: .\" must display the following acknowledgement:
20: .\" This product includes software developed by the University of
21: .\" California, Berkeley and its contributors.
22: .\" 4. Neither the name of the University nor the names of its contributors
23: .\" may be used to endorse or promote products derived from this software
24: .\" without specific prior written permission.
25: .\"
26: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36: .\" SUCH DAMAGE.
37: .\"
38: .\" @(#)id.1 8.2 (Berkeley) 5/5/94
39: .\"
1.6 aaron 40: .Dd May 5, 1994
1.1 deraadt 41: .Dt ID 1
1.5 aaron 42: .Os
1.1 deraadt 43: .Sh NAME
44: .Nm id
45: .Nd return user identity
46: .Sh SYNOPSIS
47: .Nm id
48: .Op Ar user
49: .Nm id
50: .Fl G Op Fl n
51: .Op Ar user
52: .Nm id
53: .Fl g Op Fl nr
54: .Op Ar user
55: .Nm id
56: .Fl p
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
76: .It Fl G
77: Display the different group IDs (effective, real and supplementary)
1.8 aaron 78: as whitespace separated numbers, in no particular order.
1.1 deraadt 79: .It Fl g
80: Display the effective group ID as a number.
81: .It Fl n
82: Display the name of the user or group ID for the
83: .Fl G ,
84: .Fl g
85: and
86: .Fl u
87: options instead of the number.
88: If any of the ID numbers cannot be mapped into names, the number will be
89: displayed as usual.
90: .It Fl p
91: Make the output human-readable.
92: If the user name returned by
93: .Xr getlogin 2
94: is different from the login name referenced by the user ID, the name
95: returned by
96: .Xr getlogin 2
1.9 ! aaron 97: is displayed, preceded by the keyword
! 98: .Dq login .
! 99: The user ID as a name is displayed, preceded by the keyword
! 100: .Dq uid .
1.1 deraadt 101: If the effective user ID is different from the real user ID, the real user
1.9 ! aaron 102: ID is displayed as a name, preceded by the keyword
! 103: .Dq euid .
1.1 deraadt 104: If the effective group ID is different from the real group ID, the real group
1.9 ! aaron 105: ID is displayed as a name, preceded by the keyword
! 106: .Dq rgid .
1.1 deraadt 107: The list of groups to which the user belongs is then displayed as names,
1.9 ! aaron 108: preceded by the keyword
! 109: .Dq groups .
1.1 deraadt 110: Each display is on a separate line.
111: .It Fl r
112: Display the real ID for the
113: .Fl g
114: and
115: .Fl u
116: options instead of the effective ID.
117: .It Fl u
118: Display the effective user ID as a number.
119: .El
120: .Pp
121: The
1.7 aaron 122: .Nm
1.4 aaron 123: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 124: .Sh SEE ALSO
125: .Xr who 1
126: .Sh STANDARDS
127: The
1.7 aaron 128: .Nm
1.1 deraadt 129: function is expected to conform to
130: .St -p1003.2 .
131: .Sh HISTORY
132: The
133: historic
134: .Xr groups 1
135: command is equivalent to
1.9 ! aaron 136: .Ic id Fl Gn Op Ar user .
1.1 deraadt 137: .Pp
138: The
139: historic
140: .Xr whoami 1
141: command is equivalent to
1.9 ! aaron 142: .Ic Nm id Fl un .
1.1 deraadt 143: .Pp
144: The
1.7 aaron 145: .Nm
1.1 deraadt 146: command first appeared in
147: .Bx 4.4 .