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