Annotation of src/usr.bin/id/id.1, Revision 1.11
1.11 ! jmc 1: .\" $OpenBSD: id.1,v 1.10 2003/06/03 02:56:09 millert 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.6 aaron 36: .Dd May 5, 1994
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
46: .Fl G Op Fl n
47: .Op Ar user
48: .Nm id
49: .Fl g Op Fl nr
50: .Op Ar user
51: .Nm id
52: .Fl p
53: .Nm id
54: .Fl u Op Fl nr
55: .Op Ar user
56: .Sh DESCRIPTION
57: The
1.7 aaron 58: .Nm
1.1 deraadt 59: utility displays the user and group names and numeric IDs, of the
60: calling process, to the standard output.
61: If the real and effective IDs are different, both are displayed,
62: otherwise only the real ID is displayed.
63: .Pp
64: If a
65: .Ar user
66: (login name or user ID)
67: is specified, the user and group IDs of that user are displayed.
68: In this case, the real and effective IDs are assumed to be the same.
69: .Pp
70: The options are as follows:
71: .Bl -tag -width Ds
72: .It Fl G
73: Display the different group IDs (effective, real and supplementary)
1.8 aaron 74: as whitespace separated numbers, in no particular order.
1.1 deraadt 75: .It Fl g
76: Display the effective group ID as a number.
77: .It Fl n
78: Display the name of the user or group ID for the
79: .Fl G ,
80: .Fl g
81: and
82: .Fl u
83: options instead of the number.
84: If any of the ID numbers cannot be mapped into names, the number will be
85: displayed as usual.
86: .It Fl p
87: Make the output human-readable.
88: If the user name returned by
89: .Xr getlogin 2
90: is different from the login name referenced by the user ID, the name
91: returned by
92: .Xr getlogin 2
1.9 aaron 93: is displayed, preceded by the keyword
94: .Dq login .
95: The user ID as a name is displayed, preceded by the keyword
96: .Dq uid .
1.1 deraadt 97: If the effective user ID is different from the real user ID, the real user
1.9 aaron 98: ID is displayed as a name, preceded by the keyword
99: .Dq euid .
1.1 deraadt 100: If the effective group ID is different from the real group ID, the real group
1.9 aaron 101: ID is displayed as a name, preceded by the keyword
102: .Dq rgid .
1.1 deraadt 103: The list of groups to which the user belongs is then displayed as names,
1.9 aaron 104: preceded by the keyword
105: .Dq groups .
1.1 deraadt 106: Each display is on a separate line.
107: .It Fl r
108: Display the real ID for the
109: .Fl g
110: and
111: .Fl u
112: options instead of the effective ID.
113: .It Fl u
114: Display the effective user ID as a number.
115: .El
116: .Pp
117: The
1.7 aaron 118: .Nm
1.4 aaron 119: utility exits 0 on success or >0 if an error occurred.
1.1 deraadt 120: .Sh SEE ALSO
121: .Xr who 1
122: .Sh STANDARDS
123: The
1.7 aaron 124: .Nm
1.1 deraadt 125: function is expected to conform to
126: .St -p1003.2 .
127: .Sh HISTORY
128: The
129: historic
130: .Xr groups 1
131: command is equivalent to
1.9 aaron 132: .Ic id Fl Gn Op Ar user .
1.1 deraadt 133: .Pp
134: The
135: historic
136: .Xr whoami 1
137: command is equivalent to
1.11 ! jmc 138: .Ic id Fl un .
1.1 deraadt 139: .Pp
140: The
1.7 aaron 141: .Nm
1.1 deraadt 142: command first appeared in
143: .Bx 4.4 .