xref: /openbsd/usr.bin/getent/getent.1 (revision d89ec533)
1.\"	$OpenBSD: getent.1,v 1.12 2014/10/24 10:23:32 schwarze Exp $
2.\"	$NetBSD: getent.1,v 1.13 2005/09/11 23:16:15 wiz Exp $
3.\"
4.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Luke Mewburn.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29.\" POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd $Mdocdate: October 24 2014 $
32.Dt GETENT 1
33.Os
34.Sh NAME
35.Nm getent
36.Nd get entries from administrative database
37.Sh SYNOPSIS
38.Nm
39.Ar database
40.Op Ar key ...
41.Sh DESCRIPTION
42The
43.Nm
44program retrieves and displays entries from the administrative
45database specified by
46.Ar database .
47The order in which entries are looked up
48is defined by the specific database
49(for example, the lookup order for the
50.Dq hosts
51database is determined by
52.Xr resolv.conf 5 ) .
53The display format for a given
54.Ar database
55is as per the
56.Dq traditional
57file format for that database.
58.Pp
59.Ar database
60may be one of:
61.Bl -column "netgroup" -offset indent
62.It Sy Database Ta Sy Display format
63.It ethers Ta address name
64.It group Ta group:passwd:gid:[member[,member]...]
65.It hosts Ta address name [alias ...]
66.It passwd Ta user:passwd:uid:gid:gecos:home_dir:shell
67.It protocols Ta name protocol [alias ...]
68.It rpc Ta name number [alias ...]
69.It services Ta name port/protocol [alias ...]
70.It shells Ta /path/to/shell
71.El
72.Pp
73If one or more
74.Ar key
75arguments are provided, they will be looked up in
76.Ar database
77using the appropriate function.
78For example,
79.Cm passwd
80supports a numeric UID or user name;
81.Cm hosts
82supports an IPv4 address, IPv6 address, or host name;
83and
84.Cm services
85supports a service name, service name/protocol name, numeric port, or
86numeric port/protocol name.
87.Pp
88If no
89.Ar key
90is provided and
91.Ar database
92supports enumeration, all entries for
93.Ar database
94will be retrieved using the appropriate enumeration function and printed.
95.Sh EXIT STATUS
96The
97.Nm
98utility exits with one of the following values:
99.Pp
100.Bl -tag -width Ds -offset indent -compact
101.It 0
102Success.
103.It 1
104There was an error in the command syntax.
105.It 2
106One of the specified key names was not found in
107.Ar database .
108.It 3
109There is no support for enumeration on
110.Ar database .
111.El
112.Sh SEE ALSO
113.Xr ethers 5 ,
114.Xr group 5 ,
115.Xr hosts 5 ,
116.Xr passwd 5 ,
117.Xr protocols 5 ,
118.Xr rpc 5 ,
119.Xr services 5 ,
120.Xr shells 5
121.Sh HISTORY
122A
123.Nm
124command first appeared in
125.Ox 3.9 .
126It was based on the command of the same name in
127.Tn Solaris
128and
129.Tn Linux .
130