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