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