xref: /freebsd/usr.bin/id/id.1 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
19b50d902SRodney W. Grimes.\" Copyright (c) 1991, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
59b50d902SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
69b50d902SRodney W. Grimes.\"
79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
99b50d902SRodney W. Grimes.\" are met:
109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
119b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
139b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
149b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
169b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
179b50d902SRodney W. Grimes.\"    without specific prior written permission.
189b50d902SRodney W. Grimes.\"
199b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299b50d902SRodney W. Grimes.\" SUCH DAMAGE.
309b50d902SRodney W. Grimes.\"
312bfc50bcSEdward Tomasz Napierala.Dd March 5, 2011
329b50d902SRodney W. Grimes.Dt ID 1
3362500372SRuslan Ermilov.Os
349b50d902SRodney W. Grimes.Sh NAME
359b50d902SRodney W. Grimes.Nm id
369b50d902SRodney W. Grimes.Nd return user identity
379b50d902SRodney W. Grimes.Sh SYNOPSIS
388fe908efSRuslan Ermilov.Nm
399b50d902SRodney W. Grimes.Op Ar user
408fe908efSRuslan Ermilov.Nm
41f4882b24SRobert Watson.Fl A
42f4882b24SRobert Watson.Nm
439b50d902SRodney W. Grimes.Fl G Op Fl n
449b50d902SRodney W. Grimes.Op Ar user
458fe908efSRuslan Ermilov.Nm
46300b40afSRobert Watson.Fl M
47300b40afSRobert Watson.Nm
48bd706105SDavid E. O'Brien.Fl P
49bd706105SDavid E. O'Brien.Op Ar user
508fe908efSRuslan Ermilov.Nm
512bfc50bcSEdward Tomasz Napierala.Fl c
522bfc50bcSEdward Tomasz Napierala.Nm
539b50d902SRodney W. Grimes.Fl g Op Fl nr
549b50d902SRodney W. Grimes.Op Ar user
558fe908efSRuslan Ermilov.Nm
569b50d902SRodney W. Grimes.Fl p
57f72286afSChris Costello.Op Ar user
588fe908efSRuslan Ermilov.Nm
599b50d902SRodney W. Grimes.Fl u Op Fl nr
609b50d902SRodney W. Grimes.Op Ar user
619b50d902SRodney W. Grimes.Sh DESCRIPTION
629b50d902SRodney W. GrimesThe
6393e0d62dSJohn-Mark Gurney.Nm
649b50d902SRodney W. Grimesutility displays the user and group names and numeric IDs, of the
659b50d902SRodney W. Grimescalling process, to the standard output.
669b50d902SRodney W. GrimesIf the real and effective IDs are different, both are displayed,
679b50d902SRodney W. Grimesotherwise only the real ID is displayed.
689b50d902SRodney W. Grimes.Pp
699b50d902SRodney W. GrimesIf a
709b50d902SRodney W. Grimes.Ar user
719b50d902SRodney W. Grimes(login name or user ID)
729b50d902SRodney W. Grimesis specified, the user and group IDs of that user are displayed.
739b50d902SRodney W. GrimesIn this case, the real and effective IDs are assumed to be the same.
749b50d902SRodney W. Grimes.Pp
759b50d902SRodney W. GrimesThe options are as follows:
76540939b4SPhilippe Charnier.Bl -tag -width indent
77f4882b24SRobert Watson.It Fl A
78f4882b24SRobert WatsonDisplay the process audit user ID and other process audit properties, which
79f4882b24SRobert Watsonrequires privilege.
809b50d902SRodney W. Grimes.It Fl G
819b50d902SRodney W. GrimesDisplay the different group IDs (effective, real and supplementary)
829b50d902SRodney W. Grimesas white-space separated numbers, in no particular order.
83300b40afSRobert Watson.It Fl M
845b8e7b6bSRobert DrehmelDisplay the MAC label of the current process.
85bd706105SDavid E. O'Brien.It Fl P
86bd706105SDavid E. O'BrienDisplay the id as a password file entry.
87de5e5e6eSCeri Davies.It Fl a
88de5e5e6eSCeri DaviesIgnored for compatibility with other
89de5e5e6eSCeri Davies.Nm
90de5e5e6eSCeri Daviesimplementations.
912bfc50bcSEdward Tomasz Napierala.It Fl c
922bfc50bcSEdward Tomasz NapieralaDisplay current login class.
939b50d902SRodney W. Grimes.It Fl g
949b50d902SRodney W. GrimesDisplay the effective group ID as a number.
959b50d902SRodney W. Grimes.It Fl n
969b50d902SRodney W. GrimesDisplay the name of the user or group ID for the
979b50d902SRodney W. Grimes.Fl G ,
989b50d902SRodney W. Grimes.Fl g
999b50d902SRodney W. Grimesand
1009b50d902SRodney W. Grimes.Fl u
1019b50d902SRodney W. Grimesoptions instead of the number.
1029b50d902SRodney W. GrimesIf any of the ID numbers cannot be mapped into names, the number will be
1039b50d902SRodney W. Grimesdisplayed as usual.
1049b50d902SRodney W. Grimes.It Fl p
1059b50d902SRodney W. GrimesMake the output human-readable.
1069b50d902SRodney W. GrimesIf the user name returned by
1079b50d902SRodney W. Grimes.Xr getlogin 2
1089b50d902SRodney W. Grimesis different from the login name referenced by the user ID, the name
1099b50d902SRodney W. Grimesreturned by
1109b50d902SRodney W. Grimes.Xr getlogin 2
11193e0d62dSJohn-Mark Gurneyis displayed, preceded by the keyword
11293e0d62dSJohn-Mark Gurney.Dq login .
11393e0d62dSJohn-Mark GurneyThe user ID as a name is displayed, preceded by the keyword
11493e0d62dSJohn-Mark Gurney.Dq uid .
1159b50d902SRodney W. GrimesIf the effective user ID is different from the real user ID, the real user
11693e0d62dSJohn-Mark GurneyID is displayed as a name, preceded by the keyword
11793e0d62dSJohn-Mark Gurney.Dq euid .
1189b50d902SRodney W. GrimesIf the effective group ID is different from the real group ID, the real group
11993e0d62dSJohn-Mark GurneyID is displayed as a name, preceded by the keyword
12093e0d62dSJohn-Mark Gurney.Dq rgid .
1219b50d902SRodney W. GrimesThe list of groups to which the user belongs is then displayed as names,
12293e0d62dSJohn-Mark Gurneypreceded by the keyword
12393e0d62dSJohn-Mark Gurney.Dq groups .
1249b50d902SRodney W. GrimesEach display is on a separate line.
1259b50d902SRodney W. Grimes.It Fl r
1269b50d902SRodney W. GrimesDisplay the real ID for the
1279b50d902SRodney W. Grimes.Fl g
1289b50d902SRodney W. Grimesand
1299b50d902SRodney W. Grimes.Fl u
1309b50d902SRodney W. Grimesoptions instead of the effective ID.
1319b50d902SRodney W. Grimes.It Fl u
1329b50d902SRodney W. GrimesDisplay the effective user ID as a number.
1339b50d902SRodney W. Grimes.El
134a866e170SRuslan Ermilov.Sh EXIT STATUS
135d628d776SRuslan Ermilov.Ex -std
136*97c81625SFernando Apesteguía.Sh EXAMPLES
137*97c81625SFernando ApesteguíaShow information for the user
138*97c81625SFernando Apesteguía.Ql bob
139*97c81625SFernando Apesteguíaas a password file entry:
140*97c81625SFernando Apesteguía.Bd -literal -offset indent
141*97c81625SFernando Apesteguía$ id -P bob
142*97c81625SFernando Apesteguíabob:*:0:0::0:0:Robert:/bob:/usr/local/bin/bash
143*97c81625SFernando Apesteguía.Ed
144*97c81625SFernando Apesteguía.Pp
145*97c81625SFernando ApesteguíaSame output as
146*97c81625SFernando Apesteguía.Xr groups 1 for the root user:
147*97c81625SFernando Apesteguía.Bd -literal -offset indent
148*97c81625SFernando Apesteguía$ id -Gn root
149*97c81625SFernando Apesteguíawheel operator
150*97c81625SFernando Apesteguía.Ed
151*97c81625SFernando Apesteguía.Pp
152*97c81625SFernando ApesteguíaShow human readable information about
153*97c81625SFernando Apesteguía.Ql alice :
154*97c81625SFernando Apesteguía.Bd -literal -offset indent
155*97c81625SFernando Apesteguía$ id -p alice
156*97c81625SFernando Apesteguíauid     alice
157*97c81625SFernando Apesteguíagroups  alice webcamd vboxusers
158*97c81625SFernando Apesteguía.Ed
159*97c81625SFernando Apesteguía.Pp
160*97c81625SFernando ApesteguíaAssuming the user
161*97c81625SFernando Apesteguía.Ql bob
162*97c81625SFernando Apesteguíaexecuted
163*97c81625SFernando Apesteguía.Dq Nm su Fl l
164*97c81625SFernando Apesteguíato simulate a root login, compare the result of the following commands:
165*97c81625SFernando Apesteguía.Bd -literal -offset indent
166*97c81625SFernando Apesteguía# id -un
167*97c81625SFernando Apesteguíaroot
168*97c81625SFernando Apesteguía# who am i
169*97c81625SFernando Apesteguíabob          pts/5        Dec  4 19:51
170*97c81625SFernando Apesteguía.Ed
1719b50d902SRodney W. Grimes.Sh SEE ALSO
172*97c81625SFernando Apesteguía.Xr groups 1 ,
1739b50d902SRodney W. Grimes.Xr who 1
1749b50d902SRodney W. Grimes.Sh STANDARDS
1759b50d902SRodney W. GrimesThe
17693e0d62dSJohn-Mark Gurney.Nm
1779b50d902SRodney W. Grimesfunction is expected to conform to
1789b50d902SRodney W. Grimes.St -p1003.2 .
1799b50d902SRodney W. Grimes.Sh HISTORY
1809b50d902SRodney W. GrimesThe
1819b50d902SRodney W. Grimeshistoric
1829b50d902SRodney W. Grimes.Xr groups 1
1839b50d902SRodney W. Grimescommand is equivalent to
1849b50d902SRodney W. Grimes.Dq Nm id Fl Gn Op Ar user .
1859b50d902SRodney W. Grimes.Pp
1869b50d902SRodney W. GrimesThe
1879b50d902SRodney W. Grimeshistoric
1889b50d902SRodney W. Grimes.Xr whoami 1
1899b50d902SRodney W. Grimescommand is equivalent to
1909b50d902SRodney W. Grimes.Dq Nm id Fl un .
1919b50d902SRodney W. Grimes.Pp
1929b50d902SRodney W. GrimesThe
1939b50d902SRodney W. Grimes.Nm
19493e0d62dSJohn-Mark Gurneycommand appeared in
1959b50d902SRodney W. Grimes.Bx 4.4 .
196