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