6253 F_GETLK doesn't always return lock owner
[illumos-gate.git] / usr / src / man / man1m / getent.1m
blob2916b821fae5034e4b65d99374ef33099185f9d6
1 '\" te
2 .\" Copyright (c) 2014 Gary Mills
3 .\" Copyright (C) 1999, Sun Microsystems, Inc. All Rights Reserved
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH GETENT 1M "Mar 14, 2014"
8 .SH NAME
9 getent \- get entries from administrative database
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBgetent\fR \fIdatabase\fR [\fIkey\fR]...
14 .fi
16 .SH DESCRIPTION
17 .sp
18 .LP
19 \fBgetent\fR gets a list of entries from the administrative database specified
20 by \fIdatabase\fR. The information generally comes from one or more of the
21 sources that are specified for the \fIdatabase\fR in \fB/etc/nsswitch.conf\fR.
22 .sp
23 .LP
24 \fIdatabase\fR is the name of the database to be examined. This can be
25 \fBpasswd\fR, \fBshadow\fR, \fBgroup\fR, \fBhosts\fR, \fBipnodes\fR, \fBservices\fR,
26 \fBprotocols\fR, \fBethers\fR, \fBproject\fR, \fBnetworks\fR, or
27 \fBnetmasks\fR. For each of these databases, \fBgetent\fR uses the appropriate
28 library routines described in \fBgetpwnam\fR(3C), \fBgetspnam\fR(3C), \fBgetgrnam\fR(3C),
29 \fBgethostbyaddr\fR(3NSL), \fBgethostbyname\fR(3NSL),
30 \fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET),
31 \fBgetservbyname\fR(3SOCKET), \fBgetprotobyname\fR(3SOCKET),
32 \fBethers\fR(3SOCKET), \fBgetprojbyname\fR(3PROJECT) and
33 \fBgetnetbyname\fR(3SOCKET), respectively.
34 .sp
35 .LP
36 Each \fIkey\fR must be in a format appropriate for searching on the respective
37 database. For example, it can be a \fIusername\fR or \fInumeric-uid\fR for
38 \fBpasswd\fR; \fIhostname\fR or \fIIP\fR \fIaddress\fR for \fBhosts\fR; or
39 \fIservice\fR, \fIservice/protocol\fR, \fIport\fR, or \fIport/proto\fR for
40 \fBservices\fR.
41 .sp
42 .LP
43 \fBgetent\fR prints out the database entries that match each of the supplied
44 keys, one per line, in the format of the matching administrative file:
45 \fBpasswd\fR(4), \fBshadow\fR(4), \fBgroup\fR(4), \fBproject\fR(4), \fBhosts\fR(4),
46 \fBservices\fR(4), \fBprotocols\fR(4), \fBethers\fR(3SOCKET),
47 \fBnetworks\fR(4), or \fBnetmasks\fR(4). If no key is given, all entries
48 returned by the corresponding enumeration library routine, for example,
49 \fBgetpwent()\fR or \fBgethostent()\fR, are printed. Enumeration is not
50 supported on \fBipnodes\fR.
51 .SS "Key Interpretation for \fBpasswd\fR and \fBgroup\fR Databases"
52 .sp
53 .LP
54 When \fBgetent\fR is invoked with database set to \fBpasswd\fR, each key value
55 is processed as follows:
56 .RS +4
57 .TP
58 .ie t \(bu
59 .el o
60 If the key value consists only of numeric characters, \fBgetent\fR assumes that
61 the key value is a numeric user ID and searches the user database for a
62 matching user ID.
63 .RE
64 .RS +4
65 .TP
66 .ie t \(bu
67 .el o
68 If the user ID is not found in the user database or if the key value contains
69 any non-numeric characters, \fBgetent\fR assumes the key value is a user name
70 and searches the user database for a matching user name.
71 .RE
72 .sp
73 .LP
74 Similarly, when \fBgetent\fR is invoked with database set to \fBgroup\fR, each
75 key value is processed as follows:
76 .RS +4
77 .TP
78 .ie t \(bu
79 .el o
80 If the key value consists only of numeric characters, \fBgetent\fR assumes that
81 the key value is a numeric group ID and searches the group database for a
82 matching group ID.
83 .RE
84 .RS +4
85 .TP
86 .ie t \(bu
87 .el o
88 If the group ID is not found in the \fBgroup\fR database or if the key value
89 contains any non-numeric characters, \fBgetent\fR assumes the key value is a
90 group name and searches the \fBgroup\fR database for a matching group name.
91 .RE
92 .SH EXIT STATUS
93 .sp
94 .LP
95 The following exit values are returned:
96 .sp
97 .ne 2
98 .na
99 \fB\fB0\fR\fR
101 .RS 5n
102 Successful completion.
106 .ne 2
108 \fB\fB1\fR\fR
110 .RS 5n
111 Command syntax was incorrect, an invalid option was used, or an internal error
112 occurred.
116 .ne 2
118 \fB\fB2\fR\fR
120 .RS 5n
121 At least one of the specified entry names was not found in the database.
125 .ne 2
127 \fB\fB3\fR\fR
129 .RS 5n
130 There is no support for enumeration on this database.
133 .SH FILES
135 .ne 2
137 \fB\fB/etc/nsswitch.conf\fR\fR
139 .RS 22n
140 name service switch configuration file
144 .ne 2
146 \fB\fB/etc/passwd\fR\fR
148 .RS 22n
149 password file
153 .ne 2
155 \fB\fB/etc/shadow\fR\fR
157 .RS 22n
158 shadowed password file
162 .ne 2
164 \fB\fB/etc/group\fR\fR
166 .RS 22n
167 group file
171 .ne 2
173 \fB\fB/etc/inet/hosts\fR\fR
175 .RS 22n
176 IPv4 and IPv6 host name database
180 .ne 2
182 \fB\fB/etc/services\fR\fR
184 .RS 22n
185 Internet services and aliases
189 .ne 2
191 \fB\fB/etc/project\fR\fR
193 .RS 22n
194 project file
198 .ne 2
200 \fB\fB/etc/protocols\fR\fR
202 .RS 22n
203 protocol name database
207 .ne 2
209 \fB\fB/etc/ethers\fR\fR
211 .RS 22n
212 Ethernet address to hostname database or domain
216 .ne 2
218 \fB\fB/etc/networks\fR\fR
220 .RS 22n
221 network name database
225 .ne 2
227 \fB\fB/etc/netmasks\fR\fR
229 .RS 22n
230 network mask database
233 .SH SEE ALSO
236 \fBethers\fR(3SOCKET), \fBgetgrnam\fR(3C), \fBgethostbyaddr\fR(3NSL),
237 \fBgethostbyname\fR(3NSL), \fBgethostent\fR(3NSL),
238 \fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET),
239 \fBgetnetbyname\fR(3SOCKET), \fBgetprojbyname\fR(3PROJECT),
240 \fBgetprotobyname\fR(3SOCKET), \fBgetpwnam\fR(3C),
241 \fBgetservbyname\fR(3SOCKET), \fBgroup\fR(4), \fBhosts\fR(4),
242 \fBnetmasks\fR(4), \fBnetworks\fR(4), \fBnsswitch.conf\fR(4), \fBpasswd\fR(4),
243 \fBproject\fR(4), \fBprotocols\fR(4), \fBservices\fR(4), \fBattributes\fR(5)