]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/id/id.1
zfs: merge openzfs/zfs@688514e47
[FreeBSD/FreeBSD.git] / usr.bin / id / id.1
1 .\" Copyright (c) 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .Dd March 5, 2011
32 .Dt ID 1
33 .Os
34 .Sh NAME
35 .Nm id
36 .Nd return user identity
37 .Sh SYNOPSIS
38 .Nm
39 .Op Ar user
40 .Nm
41 .Fl A
42 .Nm
43 .Fl G Op Fl n
44 .Op Ar user
45 .Nm
46 .Fl M
47 .Nm
48 .Fl P
49 .Op Ar user
50 .Nm
51 .Fl c
52 .Nm
53 .Fl g Op Fl nr
54 .Op Ar user
55 .Nm
56 .Fl p
57 .Op Ar user
58 .Nm
59 .Fl u Op Fl nr
60 .Op Ar user
61 .Sh DESCRIPTION
62 The
63 .Nm
64 utility displays the user and group names and numeric IDs, of the
65 calling process, to the standard output.
66 If the real and effective IDs are different, both are displayed,
67 otherwise only the real ID is displayed.
68 .Pp
69 If a
70 .Ar user
71 (login name or user ID)
72 is specified, the user and group IDs of that user are displayed.
73 In this case, the real and effective IDs are assumed to be the same.
74 .Pp
75 The options are as follows:
76 .Bl -tag -width indent
77 .It Fl A
78 Display the process audit user ID and other process audit properties, which
79 requires privilege.
80 .It Fl G
81 Display the different group IDs (effective, real and supplementary)
82 as white-space separated numbers, in no particular order.
83 .It Fl M
84 Display the MAC label of the current process.
85 .It Fl P
86 Display the id as a password file entry.
87 .It Fl a
88 Ignored for compatibility with other
89 .Nm
90 implementations.
91 .It Fl c
92 Display current login class.
93 .It Fl g
94 Display the effective group ID as a number.
95 .It Fl n
96 Display the name of the user or group ID for the
97 .Fl G ,
98 .Fl g
99 and
100 .Fl u
101 options instead of the number.
102 If any of the ID numbers cannot be mapped into names, the number will be
103 displayed as usual.
104 .It Fl p
105 Make the output human-readable.
106 If the user name returned by
107 .Xr getlogin 2
108 is different from the login name referenced by the user ID, the name
109 returned by
110 .Xr getlogin 2
111 is displayed, preceded by the keyword
112 .Dq login .
113 The user ID as a name is displayed, preceded by the keyword
114 .Dq uid .
115 If the effective user ID is different from the real user ID, the real user
116 ID is displayed as a name, preceded by the keyword
117 .Dq euid .
118 If the effective group ID is different from the real group ID, the real group
119 ID is displayed as a name, preceded by the keyword
120 .Dq rgid .
121 The list of groups to which the user belongs is then displayed as names,
122 preceded by the keyword
123 .Dq groups .
124 Each display is on a separate line.
125 .It Fl r
126 Display the real ID for the
127 .Fl g
128 and
129 .Fl u
130 options instead of the effective ID.
131 .It Fl u
132 Display the effective user ID as a number.
133 .El
134 .Sh EXIT STATUS
135 .Ex -std
136 .Sh EXAMPLES
137 Show information for the user
138 .Ql bob
139 as a password file entry:
140 .Bd -literal -offset indent
141 $ id -P bob
142 bob:*:0:0::0:0:Robert:/bob:/usr/local/bin/bash
143 .Ed
144 .Pp
145 Same output as
146 .Xr groups 1 for the root user:
147 .Bd -literal -offset indent
148 $ id -Gn root
149 wheel operator
150 .Ed
151 .Pp
152 Show human readable information about
153 .Ql alice :
154 .Bd -literal -offset indent
155 $ id -p alice
156 uid     alice
157 groups  alice webcamd vboxusers
158 .Ed
159 .Pp
160 Assuming the user
161 .Ql bob
162 executed
163 .Dq Nm su Fl l
164 to simulate a root login, compare the result of the following commands:
165 .Bd -literal -offset indent
166 # id -un
167 root
168 # who am i
169 bob          pts/5        Dec  4 19:51
170 .Ed
171 .Sh SEE ALSO
172 .Xr groups 1 ,
173 .Xr who 1
174 .Sh STANDARDS
175 The
176 .Nm
177 function is expected to conform to
178 .St -p1003.2 .
179 .Sh HISTORY
180 The
181 historic
182 .Xr groups 1
183 command is equivalent to
184 .Dq Nm id Fl Gn Op Ar user .
185 .Pp
186 The
187 historic
188 .Xr whoami 1
189 command is equivalent to
190 .Dq Nm id Fl un .
191 .Pp
192 The
193 .Nm
194 command appeared in
195 .Bx 4.4 .