'\" te .\" Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. .TH getent 1M "10 Mar 2011" "SunOS 5.11" "System Administration Commands" .SH NAME getent \- get entries from administrative database .SH SYNOPSIS .LP .nf \fBgetent\fR \fIdatabase\fR [\fIkey\fR]... .fi .SH DESCRIPTION .sp .LP \fBgetent\fR gets a list of entries from the administrative database specified by \fIdatabase\fR. The information generally comes from one or more of the sources that are specified for the \fIdatabase\fR in \fB/etc/nsswitch.conf\fR. .sp .LP \fIdatabase\fR is the name of the database to be examined. This can be \fBpasswd\fR, \fBgroup\fR, \fBhosts\fR, \fBipnodes\fR, \fBservices\fR, \fBprotocols\fR, \fBauth_attr\fR or \fBexec_attr\fR. For each of these databases, \fBgetent\fR uses the appropriate library routines described in \fBgetpwnam\fR(3C), \fBgetgrnam\fR(3C), \fBgethostbyaddr\fR(3NSL), \fBgethostbyname\fR(3NSL), \fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET), \fBgetservbyname\fR(3SOCKET), \fBgetprotobyname\fR(3SOCKET), \fBgetprofattr\fR(3C), \fBgetauthattr\fR(3C), and \fBgetexecattr\fR(3C), respectively. .sp .LP Each \fIkey\fR must be in a format appropriate for searching on the respective database. For example, it can be a \fIusername\fR or \fInumeric-uid\fR for \fBpasswd\fR; \fIhostname\fR or \fIIP\fR \fIaddress\fR for \fBhosts\fR; or \fIservice\fR, \fIservice/protocol\fR, \fIport\fR, or \fIport/proto\fR for \fBservices\fR. .sp .LP \fBgetent\fR prints out the database entries that match each of the supplied keys, one per line, in the format of the matching administrative file: \fBpasswd\fR(4), \fBgroup\fR(4), \fBproject\fR(4), \fBnetworks\fR(4), \fBnetmasks\fR(4), \fBuser_attr\fR(4), \fBprof_attr\fR(4), \fBauth_attr\fR(4), or \fBexec_attr\fR(4). The key for \fBexec_attr\fR(4) is a profile name. If no key is given, all entries returned by the corresponding enumeration library routine, for example, \fBgetpwent()\fR or \fBgethostent()\fR, are printed. Enumeration is not supported on \fBipnodes\fR, \fBethers\fR, and \fBnetmasks\fR. .SS "Key Interpretation for \fBpasswd\fR and \fBgroup\fR Databases" .sp .LP When \fBgetent\fR is invoked with database set to \fBpasswd\fR, each key value is processed as follows: .RS +4 .TP .ie t \(bu .el o If the key value consists only of numeric characters, \fBgetent\fR assumes that the key value is a numeric user ID and searches the user database for a matching user ID. .RE .RS +4 .TP .ie t \(bu .el o If the user ID is not found in the user database or if the key value contains any non-numeric characters, \fBgetent\fR assumes the key value is a user name and searches the user database for a matching user name. .RE .sp .LP Similarly, when \fBgetent\fR is invoked with database set to \fBgroup\fR, each key value is processed as follows: .RS +4 .TP .ie t \(bu .el o If the key value consists only of numeric characters, \fBgetent\fR assumes that the key value is a numeric group ID and searches the group database for a matching group ID. .RE .RS +4 .TP .ie t \(bu .el o If the group ID is not found in the \fBgroup\fR database or if the key value contains any non-numeric characters, \fBgetent\fR assumes the key value is a group name and searches the \fBgroup\fR database for a matching group name. .RE .sp .LP When \fBgetent\fR is invoked with database set to \fBuser_attr\fR(4), each key value is processed as follows: .RS +4 .TP .ie t \(bu .el o If the key value consists only of numeric characters, \fBgetent\fR assumes that the key value is a numeric user ID and searches the user database for a matching user ID. .RE .RS +4 .TP .ie t \(bu .el o If the key value contains any non-numeric characters, \fBgetent\fR assumes the key value is a user name and searches the user database for a matching user name. .RE .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 5n .rt Successful completion. .RE .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .RS 5n .rt Command syntax was incorrect, an invalid option was used, or an internal error occurred. .RE .sp .ne 2 .mk .na \fB\fB2\fR\fR .ad .RS 5n .rt At least one of the specified entry names was not found in the database. .RE .sp .ne 2 .mk .na \fB\fB3\fR\fR .ad .RS 5n .rt There is no support for enumeration on this database. .RE .SH FILES .sp .ne 2 .mk .na \fB\fB/etc/nsswitch.conf\fR\fR .ad .RS 27n .rt name service switch configuration file .RE .sp .ne 2 .mk .na \fB\fB/etc/passwd\fR\fR .ad .RS 27n .rt password file .RE .sp .ne 2 .mk .na \fB\fB/etc/group\fR\fR .ad .RS 27n .rt group file .RE .sp .ne 2 .mk .na \fB\fB/etc/inet/hosts\fR\fR .ad .RS 27n .rt IPv4 and IPv6 host name database .RE .sp .ne 2 .mk .na \fB\fB/etc/services\fR\fR .ad .RS 27n .rt Internet services and aliases .RE .sp .ne 2 .mk .na \fB\fB/etc/project\fR\fR .ad .RS 27n .rt project file .RE .sp .ne 2 .mk .na \fB\fB/etc/protocols\fR\fR .ad .RS 27n .rt protocol name database .RE .sp .ne 2 .mk .na \fB\fB/etc/ethers\fR\fR .ad .RS 27n .rt Ethernet address to hostname database or domain .RE .sp .ne 2 .mk .na \fB\fB/etc/networks\fR\fR .ad .RS 27n .rt network name database .RE .sp .ne 2 .mk .na \fB\fB/etc/netmasks\fR\fR .ad .RS 27n .rt network mask database .RE .sp .ne 2 .mk .na \fB\fB/etc/user_attr\fR\fR .ad .RS 27n .rt Extended user attributes .RE .sp .ne 2 .mk .na \fB\fB/etc/security/prof_attr\fR\fR .ad .RS 27n .rt Profile description database .RE .sp .ne 2 .mk .na \fB\fB/etc/security/auth_attr\fR\fR .ad .RS 27n .rt Authorization description .RE .sp .ne 2 .mk .na \fB\fB/etc/security/exec_attr\fR\fR .ad .RS 27n .rt Execution profiles database .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Availabilitysystem/core-os _ Interface StabilityCommitted .TE .SH SEE ALSO .sp .LP \fBethers\fR(3SOCKET), \fBgetgrnam\fR(3C), \fBgethostbyaddr\fR(3NSL), \fBgethostbyname\fR(3NSL), \fBgethostent\fR(3NSL), \fBgetipnodebyaddr\fR(3SOCKET), \fBgetipnodebyname\fR(3SOCKET), \fBgetnetbyname\fR(3SOCKET), \fBgetprojbyname\fR(3PROJECT), \fBgetprotobyname\fR(3SOCKET), \fBgetpwnam\fR(3C), \fBgetservbyname\fR(3SOCKET), \fBgetauthattr\fR(3C), \fBgetexecattr\fR(3C), \fBgetprofattr\fR(3C), \fBgetuserattr\fR(3C), \fBethers\fR(4), \fBgroup\fR(4), \fBhosts\fR(4), \fBnetmasks\fR(4), \fBnetworks\fR(4), \fBnsswitch.conf\fR(4), \fBauth_attr\fR(4), \fBexec_attr\fR(4), \fBpasswd\fR(4), \fBprof_attr\fR(4), \fBproject\fR(4), \fBprotocols\fR(4), \fBservices\fR(4), \fBuser_attr\fR(4), \fBattributes\fR(5)