Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man8 / getent.8
blobe1783bfb878df337ea837cb89f8819d544f504f8
1 .\"
2 .\" The contents of this file are subject to the terms of the
3 .\" Common Development and Distribution License (the "License").
4 .\" You may not use this file except in compliance with the License.
5 .\"
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7 .\" or http://www.opensolaris.org/os/licensing.
8 .\" See the License for the specific language governing permissions
9 .\" and limitations under the License.
10 .\"
11 .\" When distributing Covered Code, include this CDDL HEADER in each
12 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
13 .\" If applicable, add the following below this CDDL HEADER, with the
14 .\" fields enclosed by brackets "[]" replaced with your own identifying
15 .\" information: Portions Copyright [yyyy] [name of copyright owner]
16 .\"
17 .\"
18 .\" Copyright (C) 1999, Sun Microsystems, Inc. All Rights Reserved
19 .\" Copyright (c) 2014 Gary Mills
20 .\" Copyright (c) 2018 Peter Tribble
21 .\"
22 .Dd August 13, 2018
23 .Dt GETENT 8
24 .Os
25 .Sh NAME
26 .Nm getent
27 .Nd get entries from administrative database
28 .Sh SYNOPSIS
29 .Nm
30 .Ar database
31 .Oo Ar key Oc Ns ...
32 .Sh DESCRIPTION
33 .Nm
34 gets a list of entries from the administrative database specified by
35 .Ar database .
36 The information generally comes from one or more of the sources that are
37 specified for the
38 .Ar database
40 .Pa /etc/nsswitch.conf .
41 .Pp
42 .Ar database
43 is the name of the database to be examined.
44 This can be
45 .Cm passwd ,
46 .Cm shadow ,
47 .Cm group ,
48 .Cm hosts ,
49 .Cm ipnodes ,
50 .Cm services ,
51 .Cm protocols ,
52 .Cm ethers ,
53 .Cm project ,
54 .Cm networks ,
55 .Cm netmasks ,
56 .Cm auth_attr ,
57 .Cm exec_attr ,
58 .Cm prof_attr ,
60 .Cm user_attr .
61 For each of these databases,
62 .Nm
63 uses the appropriate library routines described in
64 .Xr getpwnam 3C ,
65 .Xr getspnam 3C ,
66 .Xr getgrnam 3C ,
67 .Xr gethostbyaddr 3NSL ,
68 .Xr gethostbyname 3NSL ,
69 .Xr getipnodebyaddr 3SOCKET ,
70 .Xr getipnodebyname 3SOCKET ,
71 .Xr getservbyname 3SOCKET ,
72 .Xr getprotobyname 3SOCKET ,
73 .Xr ethers 3SOCKET ,
74 .Xr getprojbyname 3PROJECT ,
75 .Xr getnetbyname 3SOCKET ,
76 .Xr getauthattr 3SECDB ,
77 .Xr getexecattr 3SECDB ,
78 .Xr getprofattr 3SECDB ,
79 and
80 .Xr getuserattr 3SECDB
81 respectively.
82 .Pp
83 Each
84 .Ar key
85 must be in a format appropriate for searching on the respective database.
86 For example, it can be a username or numeric-uid for
87 .Cm passwd ;
88 hostname or IP address for
89 .Cm hosts ;
90 or service, service/protocol, port, or port/proto for
91 .Cm services .
92 .Pp
93 .Nm
94 prints out the database entries that match each of the supplied keys, one per
95 line, in the format of the matching administrative file:
96 .Xr passwd 4 ,
97 .Xr shadow 4 ,
98 .Xr group 4 ,
99 .Xr project 4 ,
100 .Xr hosts 4 ,
101 .Xr services 4 ,
102 .Xr protocols 4 ,
103 .Xr ethers 4 ,
104 .Xr networks 4 ,
105 .Xr netmasks 4 ,
106 .Xr auth_attr 4 ,
107 .Xr exec_attr 4 ,
108 .Xr prof_attr 4 ,
110 .Xr user_attr 4 .
111 If no key is given, all entries returned by the corresponding enumeration
112 library routine, for example,
113 .Xr getpwent 3C
115 .Xr gethostent 3NSL ,
116 are printed.
117 Enumeration is not supported on
118 .Cm ipnodes ,
119 .Cm ethers ,
121 .Cm netmasks .
122 .Ss Key Interpretation for passwd, group, and user_attr Databases
123 When
125 is invoked with
126 .Ar database
127 set to
128 .Cm passwd ,
129 each key value is processed as follows:
130 .Bl -bullet
132 If the key value consists only of numeric characters,
134 assumes that the key value is a numeric user ID and searches the
135 .Cm passwd
136 database for a matching user ID.
138 If the user ID is not found in the
139 .Cm passwd
140 database or if the key value contains any non-numeric characters,
142 assumes the key value is a user name and searches the
143 .Cm passwd
144 database for a matching user name.
147 When
149 is invoked with
150 .Ar database
151 set to
152 .Cm group ,
153 each key value is processed as follows:
154 .Bl -bullet
156 If the key value consists only of numeric characters,
158 assumes that the key value is a numeric group ID and searches the
159 .Cm group
160 database for a matching group ID.
162 If the group ID is not found in the
163 .Cm group
164 database or if the key value contains any non-numeric characters,
166 assumes the key value is a group name and searches the
167 .Cm group
168 database for a matching group name.
171 When
173 is invoked with
174 .Ar database
175 set to
176 .Cm user_attr ,
177 each key value is processed as follows:
178 .Bl -bullet
180 If the key value consists only of numeric characters,
182 assumes that the key value is a numeric user ID and searches the
183 .Cm passwd
184 database for a matching user name, which is then used as the key for
185 .Cm user_attr .
187 If the user ID is not found in the
188 .Cm passwd
189 database or if the key value contains any non-numeric characters,
191 assumes the key value is a user name and searches the
192 .Cm user_attr
193 database for a matching entry.
195 .Sh FILES
196 .Bl -tag -width Pa
197 .It Pa /etc/nsswitch.conf
198 name service switch configuration file
199 .It Pa /etc/passwd
200 password file
201 .It Pa /etc/shadow
202 shadowed password file
203 .It Pa /etc/group
204 group file
205 .It Pa /etc/inet/hosts
206 IPv4 and IPv6 host name database
207 .It Pa /etc/services
208 Internet services and aliases
209 .It Pa /etc/project
210 project file
211 .It Pa /etc/protocols
212 protocol name database
213 .It Pa /etc/ethers
214 Ethernet address to hostname database or domain
215 .It Pa /etc/networks
216 network name database
217 .It Pa /etc/netmasks
218 network mask database
219 .It Pa /etc/user_attr
220 extended user attributes database
221 .It Pa /etc/security/auth_attr
222 authorization description database
223 .It Pa /etc/security/exec_attr
224 execution profiles database
225 .It Pa /etc/security/prof_attr
226 profile description database
228 .Sh EXIT STATUS
229 The following exit values are returned:
231 .Bl -tag -width Ds -compact
232 .It Sy 0
233 Successful completion.
234 .It Sy 1
235 Command syntax was incorrect, an invalid option was used, or an internal error
236 occurred.
237 .It Sy 2
238 At least one of the specified entry names was not found in the database.
239 .It Sy 3
240 There is no support for enumeration on this database.
242 .Sh SEE ALSO
243 .Xr getgrnam 3C ,
244 .Xr getpwnam 3C ,
245 .Xr getspnam 3C ,
246 .Xr gethostbyaddr 3NSL ,
247 .Xr gethostbyname 3NSL ,
248 .Xr gethostent 3NSL ,
249 .Xr getprojbyname 3PROJECT ,
250 .Xr getauthattr 3SECDB ,
251 .Xr getexecattr 3SECDB ,
252 .Xr getprofattr 3SECDB ,
253 .Xr getuserattr 3SECDB ,
254 .Xr ethers 3SOCKET ,
255 .Xr getipnodebyaddr 3SOCKET ,
256 .Xr getipnodebyname 3SOCKET ,
257 .Xr getnetbyname 3SOCKET ,
258 .Xr getprotobyname 3SOCKET ,
259 .Xr getservbyname 3SOCKET ,
260 .Xr auth_attr 4 ,
261 .Xr ethers 4 ,
262 .Xr exec_attr 4 ,
263 .Xr group 4 ,
264 .Xr hosts 4 ,
265 .Xr netmasks 4 ,
266 .Xr networks 4 ,
267 .Xr nsswitch.conf 4 ,
268 .Xr passwd 4 ,
269 .Xr prof_attr 4 ,
270 .Xr project 4 ,
271 .Xr protocols 4 ,
272 .Xr services 4 ,
273 .Xr shadow 4 ,
274 .Xr user_attr 4 ,
275 .Xr attributes 5