| GETENT(8) | Maintenance Commands and Procedures | GETENT(8) |
getent — get
entries from administrative database
getent |
database [key]... |
getent gets a list of entries from the
administrative database specified by database. The
information generally comes from one or more of the sources that are
specified for the database in
/etc/nsswitch.conf.
database is the name of the database to be
examined. This can be passwd,
shadow, group,
hosts, ipnodes,
services, protocols,
ethers, project,
networks, netmasks,
auth_attr, exec_attr,
prof_attr, user_attr, or
netgroup. For each of these databases,
getent uses the appropriate library routines
described in getpwnam(3C),
getspnam(3C),
getgrnam(3C),
getnetgrent(3C),
gethostbyaddr(3NSL),
gethostbyname(3NSL),
getipnodebyaddr(3SOCKET),
getipnodebyname(3SOCKET),
getservbyname(3SOCKET),
getprotobyname(3SOCKET),
ethers(3SOCKET),
getprojbyname(3PROJECT),
getnetbyname(3SOCKET),
getauthattr(3SECDB),
getexecattr(3SECDB),
getprofattr(3SECDB), and
getuserattr(3SECDB)
respectively.
Each key must be in a format appropriate for
searching on the respective database. For example, it can be a username or
numeric-uid for passwd; hostname or IP address for
hosts; or service, service/protocol, port, or
port/proto for services.
getent prints out the database entries
that match each of the supplied keys, one per line, in the format of the
matching administrative file:
passwd(5),
shadow(5),
group(5),
project(5),
hosts(5),
services(5),
protocols(5),
ethers(5),
netgroup(5),
networks(5),
netmasks(5),
auth_attr(5),
exec_attr(5),
prof_attr(5), or
user_attr(5). If no key is given,
all entries returned by the corresponding enumeration library routine, for
example, getpwent(3C) or
gethostent(3NSL), are printed.
Enumeration is not supported on ipnodes,
ethers, netgroup, or
netmasks.
When getent is invoked with
database set to passwd, each
key value is processed as follows:
getent assumes that the key value is a numeric
user ID and searches the passwd database for a
matching user ID.passwd database
or if the key value contains any non-numeric characters,
getent assumes the key value is a user name and
searches the passwd database for a matching user
name.When getent is invoked with
database set to group, each
key value is processed as follows:
getent assumes that the key value is a numeric
group ID and searches the group database for a
matching group ID.group database
or if the key value contains any non-numeric characters,
getent assumes the key value is a group name and
searches the group database for a matching group
name.When getent is invoked with
database set to netgroup, only
a single lookup key is supported, which must be in the following format:
Specifying only the netgroup name will result in entries from the selected netgroup being displayed as string triples (hostname, username, domain), in a format compatible with netgroup(5).
Specifying the netgroup along with host, user and domain will filter the netgroup display based on these entries. An asterisk (*) can be used as a wildcard for the host, user or domain fields.
Since the netgroup database does not
support enumeration, a lookup key must always be specified.
When getent is invoked with
database set to user_attr,
each key value is processed as follows:
getent assumes that the key value is a numeric
user ID and searches the passwd database for a
matching user name, which is then used as the key for
user_attr.passwd database
or if the key value contains any non-numeric characters,
getent assumes the key value is a user name and
searches the user_attr database for a matching
entry.The following exit values are returned:
getgrnam(3C), getnetgrent(3C), getpwnam(3C), getspnam(3C), gethostbyaddr(3NSL), gethostbyname(3NSL), gethostent(3NSL), getprojbyname(3PROJECT), getauthattr(3SECDB), getexecattr(3SECDB), getprofattr(3SECDB), getuserattr(3SECDB), ethers(3SOCKET), getipnodebyaddr(3SOCKET), getipnodebyname(3SOCKET), getnetbyname(3SOCKET), getprotobyname(3SOCKET), getservbyname(3SOCKET), auth_attr(5), ethers(5), exec_attr(5), group(5), hosts(5), netmasks(5), networks(5), nsswitch.conf(5), passwd(5), prof_attr(5), project(5), protocols(5), services(5), shadow(5), user_attr(5), attributes(7)
| June 17, 2021 | OmniOS |