1getent(1M)              System Administration Commands              getent(1M)
2
3
4

NAME

6       getent - get entries from administrative database
7

SYNOPSIS

9       getent database [key]...
10
11

DESCRIPTION

13       getent  gets  a list of entries from the administrative database speci‐
14       fied by database. The information generally comes from one or  more  of
15       the sources that are specified for the database in /etc/nsswitch.conf.
16
17
18       database  is  the  name  of  the  database  to be examined. This can be
19       passwd, group, hosts, ipnodes, services,  protocols,  ethers,  project,
20       networks,  or  netmasks.  For  each of these databases, getent uses the
21       appropriate library routines described in  getpwnam(3C),  getgrnam(3C),
22       gethostbyaddr(3NSL),   gethostbyname(3NSL),   getipnodebyaddr(3SOCKET),
23       getipnodebyname(3SOCKET),      getservbyname(3SOCKET),      getprotoby‐
24       name(3SOCKET),  ethers(3SOCKET),  getprojbyname(3PROJECT) and getnetby‐
25       name(3SOCKET), respectively.
26
27
28       Each key must be in a format appropriate for searching on  the  respec‐
29       tive  database.  For  example,  it can be a username or numeric-uid for
30       passwd; hostname or IP address for hosts; or service, service/protocol,
31       port, or port/proto for services.
32
33
34       getent  prints out the database entries that match each of the supplied
35       keys, one per line, in the format of the matching administrative  file:
36       passwd(4),  group(4),  project(4), hosts(4), services(4), protocols(4),
37       ethers(3SOCKET), networks(4), or netmasks(4). If no key is  given,  all
38       entries  returned by the corresponding enumeration library routine, for
39       example, getpwent() or gethostent(), are printed.  Enumeration  is  not
40       supported on ipnodes.
41
42   Key Interpretation for passwd and group Databases
43       When  getent  is invoked with database set to passwd, each key value is
44       processed as follows:
45
46           o      If the key value consists only of numeric characters, getent
47                  assumes that the key value is a numeric user ID and searches
48                  the user database for a matching user ID.
49
50           o      If the user ID is not found in the user database or  if  the
51                  key   value  contains  any  non-numeric  characters,  getent
52                  assumes the key value is a user name and searches  the  user
53                  database for a matching user name.
54
55
56       Similarly,  when getent is invoked with database set to group, each key
57       value is processed as follows:
58
59           o      If the key value consists only of numeric characters, getent
60                  assumes  that  the  key  value  is  a  numeric  group ID and
61                  searches the group database for a matching group ID.
62
63           o      If the group ID is not found in the group database or if the
64                  key   value  contains  any  non-numeric  characters,  getent
65                  assumes the key value is a group name and searches the group
66                  database for a matching group name.
67

EXIT STATUS

69       The following exit values are returned:
70
71       0    Successful completion.
72
73
74       1    Command  syntax  was  incorrect, an invalid option was used, or an
75            internal error occurred.
76
77
78       2    At least one of the specified entry names was  not  found  in  the
79            database.
80
81
82       3    There is no support for enumeration on this database.
83
84

FILES

86       /etc/nsswitch.conf    name service switch configuration file
87
88
89       /etc/passwd           password file
90
91
92       /etc/group            group file
93
94
95       /etc/inet/hosts       IPv4 and IPv6 host name database
96
97
98       /etc/services         Internet services and aliases
99
100
101       /etc/project          project file
102
103
104       /etc/protocols        protocol name database
105
106
107       /etc/ethers           Ethernet address to hostname database or domain
108
109
110       /etc/networks         network name database
111
112
113       /etc/netmasks         network mask database
114
115

ATTRIBUTES

117       See attributes(5) for descriptions of the following attributes:
118
119
120
121
122       ┌─────────────────────────────┬─────────────────────────────┐
123       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
124       ├─────────────────────────────┼─────────────────────────────┤
125       │Availability                 │SUNWcsu                      │
126       └─────────────────────────────┴─────────────────────────────┘
127

SEE ALSO

129       ethers(3SOCKET),    getgrnam(3C),    gethostbyaddr(3NSL),    gethostby‐
130       name(3NSL),  gethostent(3NSL),  getipnodebyaddr(3SOCKET),  getipnodeby‐
131       name(3SOCKET),  getnetbyname(3SOCKET), getprojbyname(3PROJECT), getpro‐
132       tobyname(3SOCKET),  getpwnam(3C),   getservbyname(3SOCKET),   group(4),
133       hosts(4),   netmasks(4),   networks(4),   nsswitch.conf(4),  passwd(4),
134       project(4), protocols(4), services(4), attributes(5)
135
136
137
138SunOS 5.11                        26 Mar 2007                       getent(1M)
Impressum