]>
Commit | Line | Data |
---|---|---|
4a009a37 | 1 | .\" Copyright (c) 2011, Mark R. Bannister <cambridge@users.sourceforge.net> |
ba0315b7 | 2 | .\" Copyright (c) 2015, Robin H. Johnson <robbat2@gentoo.org> |
4a009a37 | 3 | .\" |
e4a74ca8 | 4 | .\" SPDX-License-Identifier: GPL-2.0-or-later |
4a009a37 | 5 | .\" |
a5ebdc8d | 6 | .TH getent 1 (date) "Linux man-pages (unreleased)" |
4a009a37 MB |
7 | .SH NAME |
8 | getent \- get entries from Name Service Switch libraries | |
9 | .SH SYNOPSIS | |
c7db92b9 | 10 | .nf |
2c916a1d | 11 | .B getent [\fIoption\fP]... \fIdatabase\fP \fIkey\fP... |
c7db92b9 | 12 | .fi |
4a009a37 | 13 | .SH DESCRIPTION |
3fd39ec4 | 14 | The |
a9aa137a | 15 | .B getent |
3fd39ec4 MK |
16 | command displays entries from databases supported by the |
17 | Name Service Switch libraries, | |
4a009a37 MB |
18 | which are configured in |
19 | .IR /etc/nsswitch.conf . | |
20 | If one or more | |
21 | .I key | |
3fd39ec4 MK |
22 | arguments are provided, |
23 | then only the entries that match the supplied keys will be displayed. | |
4a009a37 MB |
24 | Otherwise, if no |
25 | .I key | |
26 | is provided, all entries will be displayed (unless the database does not | |
27 | support enumeration). | |
c6d039a3 | 28 | .P |
4a009a37 MB |
29 | The |
30 | .I database | |
3fd39ec4 | 31 | may be any of those supported by the GNU C Library, listed below: |
59804ef6 | 32 | .TP |
4a009a37 MB |
33 | .B ahosts |
34 | When no | |
35 | .I key | |
3fd39ec4 | 36 | is provided, use |
4a009a37 | 37 | .BR sethostent (3), |
3fd39ec4 | 38 | .BR gethostent (3), |
4a009a37 MB |
39 | and |
40 | .BR endhostent (3) | |
41 | to enumerate the hosts database. | |
42 | This is identical to using | |
f0d0efdf | 43 | .BR hosts (5). |
4a009a37 MB |
44 | When one or more |
45 | .I key | |
3fd39ec4 | 46 | arguments are provided, pass each |
4a009a37 MB |
47 | .I key |
48 | in succession to | |
49 | .BR getaddrinfo (3) | |
50 | with the address family | |
51 | .BR AF_UNSPEC , | |
52 | enumerating each socket address structure returned. | |
53 | .TP | |
54 | .B ahostsv4 | |
55 | Same as | |
3fd39ec4 MK |
56 | .BR ahosts , |
57 | but use the address family | |
4a009a37 MB |
58 | .BR AF_INET . |
59 | .TP | |
60 | .B ahostsv6 | |
61 | Same as | |
3fd39ec4 MK |
62 | .BR ahosts , |
63 | but use the address family | |
4a009a37 MB |
64 | .BR AF_INET6 . |
65 | The call to | |
66 | .BR getaddrinfo (3) | |
67 | in this case includes the | |
68 | .B AI_V4MAPPED | |
69 | flag. | |
70 | .TP | |
71 | .B aliases | |
72 | When no | |
73 | .I key | |
3fd39ec4 | 74 | is provided, use |
4a009a37 | 75 | .BR setaliasent (3), |
3fd39ec4 | 76 | .BR getaliasent (3), |
4a009a37 MB |
77 | and |
78 | .BR endaliasent (3) | |
79 | to enumerate the aliases database. | |
80 | When one or more | |
81 | .I key | |
3fd39ec4 | 82 | arguments are provided, pass each |
4a009a37 MB |
83 | .I key |
84 | in succession to | |
85 | .BR getaliasbyname (3) | |
3fd39ec4 | 86 | and display the result. |
4a009a37 MB |
87 | .TP |
88 | .B ethers | |
89 | When one or more | |
90 | .I key | |
3fd39ec4 | 91 | arguments are provided, pass each |
4a009a37 MB |
92 | .I key |
93 | in succession to | |
94 | .BR ether_aton (3) | |
95 | and | |
96 | .BR ether_hostton (3) | |
3fd39ec4 | 97 | until a result is obtained, and display the result. |
4a009a37 MB |
98 | Enumeration is not supported on |
99 | .BR ethers , | |
100 | so a | |
101 | .I key | |
102 | must be provided. | |
103 | .TP | |
104 | .B group | |
105 | When no | |
106 | .I key | |
3fd39ec4 | 107 | is provided, use |
4a009a37 | 108 | .BR setgrent (3), |
3fd39ec4 | 109 | .BR getgrent (3), |
4a009a37 MB |
110 | and |
111 | .BR endgrent (3) | |
112 | to enumerate the group database. | |
113 | When one or more | |
114 | .I key | |
3fd39ec4 | 115 | arguments are provided, pass each numeric |
4a009a37 MB |
116 | .I key |
117 | to | |
118 | .BR getgrgid (3) | |
3fd39ec4 | 119 | and each nonnumeric |
4a009a37 MB |
120 | .I key |
121 | to | |
122 | .BR getgrnam (3) | |
3fd39ec4 | 123 | and display the result. |
4a009a37 MB |
124 | .TP |
125 | .B gshadow | |
126 | When no | |
127 | .I key | |
3fd39ec4 | 128 | is provided, use |
4a009a37 | 129 | .BR setsgent (3), |
3fd39ec4 | 130 | .BR getsgent (3), |
4a009a37 MB |
131 | and |
132 | .BR endsgent (3) | |
133 | to enumerate the gshadow database. | |
134 | When one or more | |
135 | .I key | |
3fd39ec4 | 136 | arguments are provided, pass each |
4a009a37 MB |
137 | .I key |
138 | in succession to | |
139 | .BR getsgnam (3) | |
3fd39ec4 | 140 | and display the result. |
4a009a37 MB |
141 | .TP |
142 | .B hosts | |
143 | When no | |
144 | .I key | |
3fd39ec4 | 145 | is provided, use |
4a009a37 | 146 | .BR sethostent (3), |
3fd39ec4 | 147 | .BR gethostent (3), |
4a009a37 MB |
148 | and |
149 | .BR endhostent (3) | |
150 | to enumerate the hosts database. | |
151 | When one or more | |
152 | .I key | |
3fd39ec4 | 153 | arguments are provided, pass each |
4a009a37 MB |
154 | .I key |
155 | to | |
156 | .BR gethostbyaddr (3) | |
157 | or | |
158 | .BR gethostbyname2 (3), | |
159 | depending on whether a call to | |
160 | .BR inet_pton (3) | |
161 | indicates that the | |
162 | .I key | |
3fd39ec4 | 163 | is an IPv6 or IPv4 address or not, and display the result. |
4a009a37 MB |
164 | .TP |
165 | .B initgroups | |
166 | When one or more | |
167 | .I key | |
3fd39ec4 | 168 | arguments are provided, pass each |
4a009a37 MB |
169 | .I key |
170 | in succession to | |
171 | .BR getgrouplist (3) | |
3fd39ec4 | 172 | and display the result. |
4a009a37 MB |
173 | Enumeration is not supported on |
174 | .BR initgroups , | |
175 | so a | |
176 | .I key | |
177 | must be provided. | |
178 | .TP | |
179 | .B netgroup | |
180 | When one | |
181 | .I key | |
3fd39ec4 | 182 | is provided, pass the |
4a009a37 MB |
183 | .I key |
184 | to | |
185 | .BR setnetgrent (3) | |
186 | and, using | |
187 | .BR getnetgrent (3) | |
3fd39ec4 | 188 | display the resulting string triple |
4a009a37 MB |
189 | .RI ( hostname ", " username ", " domainname ). |
190 | Alternatively, three | |
191 | .I keys | |
192 | may be provided, which are interpreted as the | |
193 | .IR hostname , | |
d556548b | 194 | .IR username , |
4a009a37 MB |
195 | and |
196 | .I domainname | |
197 | to match to a netgroup name via | |
198 | .BR innetgr (3). | |
199 | Enumeration is not supported on | |
06ba9031 | 200 | .BR netgroup , |
4a009a37 MB |
201 | so either one or three |
202 | .I keys | |
203 | must be provided. | |
204 | .TP | |
205 | .B networks | |
206 | When no | |
207 | .I key | |
3fd39ec4 | 208 | is provided, use |
4a009a37 | 209 | .BR setnetent (3), |
3fd39ec4 | 210 | .BR getnetent (3), |
4a009a37 MB |
211 | and |
212 | .BR endnetent (3) | |
213 | to enumerate the networks database. | |
214 | When one or more | |
215 | .I key | |
3fd39ec4 | 216 | arguments are provided, pass each numeric |
4a009a37 MB |
217 | .I key |
218 | to | |
219 | .BR getnetbyaddr (3) | |
3fd39ec4 | 220 | and each nonnumeric |
4a009a37 MB |
221 | .I key |
222 | to | |
223 | .BR getnetbyname (3) | |
3fd39ec4 | 224 | and display the result. |
4a009a37 MB |
225 | .TP |
226 | .B passwd | |
227 | When no | |
228 | .I key | |
3fd39ec4 | 229 | is provided, use |
4a009a37 | 230 | .BR setpwent (3), |
3fd39ec4 | 231 | .BR getpwent (3), |
4a009a37 MB |
232 | and |
233 | .BR endpwent (3) | |
234 | to enumerate the passwd database. | |
235 | When one or more | |
236 | .I key | |
3fd39ec4 | 237 | arguments are provided, pass each numeric |
4a009a37 MB |
238 | .I key |
239 | to | |
240 | .BR getpwuid (3) | |
3fd39ec4 | 241 | and each nonnumeric |
4a009a37 MB |
242 | .I key |
243 | to | |
244 | .BR getpwnam (3) | |
3fd39ec4 | 245 | and display the result. |
4a009a37 MB |
246 | .TP |
247 | .B protocols | |
248 | When no | |
249 | .I key | |
3fd39ec4 | 250 | is provided, use |
4a009a37 | 251 | .BR setprotoent (3), |
3fd39ec4 | 252 | .BR getprotoent (3), |
4a009a37 MB |
253 | and |
254 | .BR endprotoent (3) | |
255 | to enumerate the protocols database. | |
256 | When one or more | |
257 | .I key | |
3fd39ec4 | 258 | arguments are provided, pass each numeric |
4a009a37 MB |
259 | .I key |
260 | to | |
261 | .BR getprotobynumber (3) | |
3fd39ec4 | 262 | and each nonnumeric |
4a009a37 MB |
263 | .I key |
264 | to | |
265 | .BR getprotobyname (3) | |
3fd39ec4 | 266 | and display the result. |
4a009a37 MB |
267 | .TP |
268 | .B rpc | |
269 | When no | |
270 | .I key | |
3fd39ec4 | 271 | is provided, use |
4a009a37 | 272 | .BR setrpcent (3), |
3fd39ec4 | 273 | .BR getrpcent (3), |
4a009a37 MB |
274 | and |
275 | .BR endrpcent (3) | |
276 | to enumerate the rpc database. | |
277 | When one or more | |
278 | .I key | |
3fd39ec4 | 279 | arguments are provided, pass each numeric |
4a009a37 MB |
280 | .I key |
281 | to | |
282 | .BR getrpcbynumber (3) | |
3fd39ec4 | 283 | and each nonnumeric |
4a009a37 MB |
284 | .I key |
285 | to | |
286 | .BR getrpcbyname (3) | |
3fd39ec4 | 287 | and display the result. |
4a009a37 MB |
288 | .TP |
289 | .B services | |
290 | When no | |
291 | .I key | |
3fd39ec4 | 292 | is provided, use |
4a009a37 | 293 | .BR setservent (3), |
3fd39ec4 | 294 | .BR getservent (3), |
4a009a37 MB |
295 | and |
296 | .BR endservent (3) | |
297 | to enumerate the services database. | |
298 | When one or more | |
299 | .I key | |
3fd39ec4 | 300 | arguments are provided, pass each numeric |
4a009a37 MB |
301 | .I key |
302 | to | |
303 | .BR getservbynumber (3) | |
3fd39ec4 | 304 | and each nonnumeric |
4a009a37 MB |
305 | .I key |
306 | to | |
307 | .BR getservbyname (3) | |
3fd39ec4 | 308 | and display the result. |
4a009a37 MB |
309 | .TP |
310 | .B shadow | |
311 | When no | |
312 | .I key | |
3fd39ec4 | 313 | is provided, use |
4a009a37 | 314 | .BR setspent (3), |
3fd39ec4 | 315 | .BR getspent (3), |
4a009a37 MB |
316 | and |
317 | .BR endspent (3) | |
318 | to enumerate the shadow database. | |
319 | When one or more | |
320 | .I key | |
3fd39ec4 | 321 | arguments are provided, pass each |
4a009a37 MB |
322 | .I key |
323 | in succession to | |
324 | .BR getspnam (3) | |
3fd39ec4 | 325 | and display the result. |
ba0315b7 RJ |
326 | .SH OPTIONS |
327 | .TP | |
6fdb1c03 | 328 | .BI \-\-service\~ service |
5a3a191d AC |
329 | .TQ |
330 | .BI \-s\~ service | |
ba0315b7 | 331 | .\" commit 9d0881aa76b399e6a025c5cf44bebe2ae0efa8af (glibc) |
448dc232 MK |
332 | Override all databases with the specified service. |
333 | (Since glibc 2.2.5.) | |
ba0315b7 | 334 | .TP |
6fdb1c03 | 335 | .BI \-\-service\~ database : service |
5a3a191d AC |
336 | .TQ |
337 | .BI \-s\~ database : service | |
ba0315b7 | 338 | .\" commit b4f6f4be85d32b9c03361c38376e36f08100e3e8 (glibc) |
448dc232 MK |
339 | Override only specified databases with the specified service. |
340 | The option may be used multiple times, | |
341 | but only the last service for each database will be used. | |
342 | (Since glibc 2.4.) | |
ba0315b7 | 343 | .TP |
6fdb1c03 | 344 | .B \-\-no\-idn |
5a3a191d AC |
345 | .TQ |
346 | .B \-i | |
ba0315b7 RJ |
347 | .\" commit a160f8d808cf8020b13bd0ef4a9eaf3c11f964ad (glibc) |
348 | Disables IDN encoding in lookups for | |
448dc232 | 349 | .BR ahosts / getaddrinfo (3) |
ba0315b7 | 350 | (Since glibc-2.13.) |
d4c47e46 | 351 | .TP |
6fdb1c03 | 352 | .B \-\-help |
5a3a191d AC |
353 | .TQ |
354 | .B \-? | |
d4c47e46 MK |
355 | Print a usage summary and exit. |
356 | .TP | |
6fdb1c03 | 357 | .B \-\-usage |
d4c47e46 MK |
358 | Print a short usage summary and exit. |
359 | .TP | |
6fdb1c03 | 360 | .B \-\-version |
5a3a191d AC |
361 | .TQ |
362 | .B \-V | |
d4c47e46 MK |
363 | Print the version number, license, and disclaimer of warranty for |
364 | .BR getent . | |
47297adb | 365 | .SH EXIT STATUS |
4a009a37 MB |
366 | One of the following exit values can be returned by |
367 | .BR getent : | |
0019177e | 368 | .TP |
4a009a37 MB |
369 | .B 0 |
370 | Command completed successfully. | |
371 | .TP | |
372 | .B 1 | |
373 | Missing arguments, or | |
374 | .I database | |
375 | unknown. | |
376 | .TP | |
377 | .B 2 | |
378 | One or more supplied | |
379 | .I key | |
380 | could not be found in the | |
381 | .IR database . | |
382 | .TP | |
383 | .B 3 | |
384 | Enumeration not supported on this | |
385 | .IR database . | |
47297adb | 386 | .SH SEE ALSO |
3fd39ec4 | 387 | .BR nsswitch.conf (5) |