xref: /netbsd-src/usr.bin/getent/getent.1 (revision 6f8082867511a5e0d5877b35e79ff7e6ffe79ab7)
1*6f808286Swiz.\"	$NetBSD: getent.1,v 1.25 2017/10/23 01:06:05 wiz Exp $
26fc4e855Slukem.\"
36fc4e855Slukem.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
46fc4e855Slukem.\" All rights reserved.
56fc4e855Slukem.\"
66fc4e855Slukem.\" This code is derived from software contributed to The NetBSD Foundation
76fc4e855Slukem.\" by Luke Mewburn.
86fc4e855Slukem.\"
96fc4e855Slukem.\" Redistribution and use in source and binary forms, with or without
106fc4e855Slukem.\" modification, are permitted provided that the following conditions
116fc4e855Slukem.\" are met:
126fc4e855Slukem.\" 1. Redistributions of source code must retain the above copyright
136fc4e855Slukem.\"    notice, this list of conditions and the following disclaimer.
146fc4e855Slukem.\" 2. Redistributions in binary form must reproduce the above copyright
156fc4e855Slukem.\"    notice, this list of conditions and the following disclaimer in the
166fc4e855Slukem.\"    documentation and/or other materials provided with the distribution.
176fc4e855Slukem.\"
186fc4e855Slukem.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
196fc4e855Slukem.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
206fc4e855Slukem.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
216fc4e855Slukem.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
226fc4e855Slukem.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
236fc4e855Slukem.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
246fc4e855Slukem.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
256fc4e855Slukem.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
266fc4e855Slukem.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
276fc4e855Slukem.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
286fc4e855Slukem.\" POSSIBILITY OF SUCH DAMAGE.
296fc4e855Slukem.\"
3008c23328Schristos.Dd October 11, 2011
31e6c49c32Swiz.Dt GETENT 1
326fc4e855Slukem.Os
336fc4e855Slukem.Sh NAME
34a6d0162aSabhinav.Nm getent ,
35a6d0162aSabhinav.Nm getcap
3608c23328Schristos.Nd get entries from administrative databases
376fc4e855Slukem.Sh SYNOPSIS
38e6c49c32Swiz.Nm getent
39e6c49c32Swiz.Ar database
40e6c49c32Swiz.Op Ar key ...
41e6c49c32Swiz.Nm getcap
426fc4e855Slukem.Ar database
43db85937fSwiz.Op Ar key ...
446fc4e855Slukem.Sh DESCRIPTION
456fc4e855SlukemThe
466fc4e855Slukem.Nm
476fc4e855Slukemprogram retrieves and displays entries from the administrative
486fc4e855Slukemdatabase specified by
496fc4e855Slukem.Ar database ,
506fc4e855Slukemusing the lookup order specified in
516fc4e855Slukem.Xr nsswitch.conf 5 .
526fc4e855SlukemThe display format for a given
536fc4e855Slukem.Ar database
546fc4e855Slukemis as per the
556fc4e855Slukem.Dq traditional
566fc4e855Slukemfile format for that database.
576fc4e855Slukem.Pp
586fc4e855Slukem.Ar database
596fc4e855Slukemmay be one of:
60ca46068bSjoerg.Bl -column "protocols" "user:passwd:uid:gid:gecos:home_dir:shell" -offset indent -compact
61fc64dfd8Sjoerg.It Sy Database Ta Sy Display format
62ebcc6ba6Schristos.It disktab Ta entry
6321b9a99bSginsbach.It ethers Ta address name
641d50c3e3Schristos.It gettytab Ta entry
656fc4e855Slukem.It group Ta group:passwd:gid:[member[,member]...]
666d8ce32cSlukem.It hosts Ta address name [alias ...]
67684e3b35Stron.It netgroup Ta (host,user,domain) [...]
68f6f918f7Slukem.It networks Ta name network [alias ...]
692ae4fd55Swiz.It passwd Ta user:passwd:uid:gid:gecos:home_dir:shell
70ebcc6ba6Schristos.It printcap Ta entry
71309eefdaSlukem.It protocols Ta name protocol [alias ...]
726c53b19fSginsbach.It rpc Ta name number [alias ...]
736d8ce32cSlukem.It services Ta name port/protocol [alias ...]
746fc4e855Slukem.It shells Ta /path/to/shell
756fc4e855Slukem.El
766fc4e855Slukem.Pp
771468e327SginsbachIf one or more
786fc4e855Slukem.Ar key
796fc4e855Slukemarguments are provided, they will be looked up in
806fc4e855Slukem.Ar database
816fc4e855Slukemusing the appropriate function.
826fc4e855SlukemFor example,
836fc4e855Slukem.Sy passwd
842ab55b55Sginsbachsupports a numeric UID or user name;
856fc4e855Slukem.Sy hosts
862ab55b55Sginsbachsupports an IPv4 address, IPv6 address, or host name;
872ab55b55Sginsbachand
882ab55b55Sginsbach.Sy services
892ab55b55Sginsbachsupports a service name, service name/protocol name, numeric port, or
902ab55b55Sginsbachnumeric port/protocol name.
916fc4e855Slukem.Pp
926fc4e855SlukemIf no
936fc4e855Slukem.Ar key
946fc4e855Slukemis provided and
956fc4e855Slukem.Ar database
966fc4e855Slukemsupports enumeration, all entries for
976fc4e855Slukem.Ar database
986fc4e855Slukemwill be retrieved using the appropriate enumeration function and printed.
99ebcc6ba6Schristos.Pp
100ebcc6ba6SchristosFor
101ebcc6ba6Schristos.Xr cgetcap 3
1022df103a0Swizstyle databases
1032df103a0Swiz.Sy ( disktab ,
104588d0cb4Sroy.Sy printcap )
105ebcc6ba6Schristosspecifying a key, lists the entry for that key, and specifying more arguments
106ebcc6ba6Schristosafter the key are used as fields in that key, and only the values of the keys
107ebcc6ba6Schristosare returned.
108ebcc6ba6SchristosFor boolean keys
109ebcc6ba6Schristos.Dv true
1102df103a0Swizis returned if the key is found.
1112df103a0SwizIf a key is not found, then
112ebcc6ba6Schristos.Dv false
113ebcc6ba6Schristosis always
114ebcc6ba6Schristosreturned.
1156fc4e855Slukem.Sh DIAGNOSTICS
1166fc4e855Slukem.Nm
1176fc4e855Slukemexits 0 on success,
1186fc4e855Slukem1 if there was an error in the command syntax,
119f6f918f7Slukem2 if one of the specified key names was not found in
1206fc4e855Slukem.Ar database ,
1216fc4e855Slukemor 3 if there is no support for enumeration on
1226fc4e855Slukem.Ar database .
1236fc4e855Slukem.Sh SEE ALSO
124ebcc6ba6Schristos.Xr cgetcap 3 ,
1251d50c3e3Schristos.Xr disktab 5 ,
12621b9a99bSginsbach.Xr ethers 5 ,
1271d50c3e3Schristos.Xr gettytab 5 ,
128f6f918f7Slukem.Xr group 5 ,
129f6f918f7Slukem.Xr hosts 5 ,
130f6f918f7Slukem.Xr networks 5 ,
131f6f918f7Slukem.Xr nsswitch.conf 5 ,
132f6f918f7Slukem.Xr passwd 5 ,
1331d50c3e3Schristos.Xr printcap 5 ,
1342df103a0Swiz.Xr protocols 5 ,
1356c53b19fSginsbach.Xr rpc 5 ,
1366d8ce32cSlukem.Xr services 5 ,
137588d0cb4Sroy.Xr shells 5
1386fc4e855Slukem.Sh HISTORY
1396fc4e855SlukemA
1406fc4e855Slukem.Nm
1416fc4e855Slukemcommand appeared in
1426fc4e855Slukem.Nx 3.0 .
143*6f808286SwizIt was based on the command of the same name in Solaris and Linux.
144