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