Annotation of src/usr.bin/id/id.1, Revision 1.7
1.7 ! aaron 1: .\" $OpenBSD: id.1,v 1.6 1999/07/02 20:11:45 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)
78: as white-space separated numbers, in no particular order.
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
97: is displayed, preceded by the keyword ``login''.
98: The user ID as a name is displayed, preceded by the keyword ``uid''.
99: If the effective user ID is different from the real user ID, the real user
100: ID is displayed as a name, preceded by the keyword ``euid''.
101: If the effective group ID is different from the real group ID, the real group
102: ID is displayed as a name, preceded by the keyword ``rgid''.
103: The list of groups to which the user belongs is then displayed as names,
104: preceded by the keyword ``groups''.
105: Each display is on a separate line.
106: .It Fl r
107: Display the real ID for the
108: .Fl g
109: and
110: .Fl u
111: options instead of the effective ID.
112: .It Fl u
113: Display the effective user ID as a number.
114: .El
115: .Pp
116: The
1.7 ! aaron 117: .Nm
1.4 aaron 118: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 119: .Sh SEE ALSO
120: .Xr who 1
121: .Sh STANDARDS
122: The
1.7 ! aaron 123: .Nm
1.1 deraadt 124: function is expected to conform to
125: .St -p1003.2 .
126: .Sh HISTORY
127: The
128: historic
129: .Xr groups 1
130: command is equivalent to
131: .Dq Nm id Fl Gn Op Ar user .
132: .Pp
133: The
134: historic
135: .Xr whoami 1
136: command is equivalent to
137: .Dq Nm id Fl un .
138: .Pp
139: The
1.7 ! aaron 140: .Nm
1.1 deraadt 141: command first appeared in
142: .Bx 4.4 .