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