xref: /netbsd-src/usr.sbin/inetd/inetd.8 (revision ae9172d6cd9432a6a1a56760d86b32c57a66c39c)
1.\" Copyright (c) 1985, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     from: @(#)inetd.8	6.7 (Berkeley) 3/16/91
33.\"	$Id: inetd.8,v 1.5 1994/01/14 16:22:39 jtc Exp $
34.\"
35.Dd March 16, 1991
36.Dt INETD 8
37.Os BSD 4.3
38.Sh NAME
39.Nm inetd
40.Nd internet
41.Dq super-server
42.Sh SYNOPSIS
43.Nm inetd
44.Op Fl d
45.Op Ar configuration file
46.Sh DESCRIPTION
47.Nm Inetd
48should be run at boot time by
49.Pa /etc/rc.local
50(see
51.Xr rc 8 ) .
52It then listens for connections on certain
53internet sockets.  When a connection is found on one
54of its sockets, it decides what service the socket
55corresponds to, and invokes a program to service the request.
56After the program is
57finished, it continues to listen on the socket (except in some cases which
58will be described below).  Essentially,
59.Nm inetd
60allows running one daemon to invoke several others,
61reducing load on the system.
62.Pp
63The option available for
64.Nm inetd:
65.Bl -tag -width Ds
66.It Fl d
67Turns on debugging.
68.El
69.Pp
70Upon execution,
71.Nm inetd
72reads its configuration information from a configuration
73file which, by default, is
74.Pa /etc/inetd.conf .
75There must be an entry for each field of the configuration
76file, with entries for each field separated by a tab or
77a space.  Comments are denoted by a ``#'' at the beginning
78of a line.  There must be an entry for each field.  The
79fields of the configuration file are as follows:
80.Pp
81.Bd -unfilled -offset indent -compact
82service name
83socket type
84protocol
85wait/nowait[.max]
86user[.group]
87server program
88server program arguments
89.Ed
90.Pp
91To specify an
92.Em Sun-RPC
93based service, the entry would contain these fields.
94.Pp
95.Bd -unfilled -offset indent -compact
96service name/version
97socket type
98rpc/protocol
99wait/nowait[.max]
100user[.group]
101server program
102server program arguments
103.Ed
104.Pp
105The
106.Em service-name
107entry is the name of a valid service in
108the file
109.Pa /etc/services .
110For
111.Dq internal
112services (discussed below), the service
113name
114.Em must
115be the official name of the service (that is, the first entry in
116.Pa /etc/services ) .
117When used to specify a
118.Em Sun-RPC
119based service, this field is a valid RPC service name in
120the file
121.Pa /etc/rpc .
122The part on the right of the
123.Dq /
124is the RPC version number. This
125can simply be a single numeric argument or a range of versions.
126A range is bounded by the low version to the high version -
127.Dq rusers/1-3 .
128
129.Pp
130The
131.Em socket-type
132should be one of
133.Dq stream ,
134.Dq dgram ,
135.Dq raw ,
136.Dq rdm ,
137or
138.Dq seqpacket ,
139depending on whether the socket is a stream, datagram, raw,
140reliably delivered message, or sequenced packet socket.
141.Pp
142The
143.Em protocol
144must be a valid protocol as given in
145.Pa /etc/protocols .
146Examples might be
147.Dq tcp
148or
149.Dq udp .
150Rpc based services are specified with the
151.Dq rpc/tcp
152or
153.Dq rpc/udp
154service type.
155
156.Pp
157The
158.Em wait/nowait
159entry is applicable to datagram sockets only (other sockets should
160have a
161.Dq nowait
162entry in this space).  If a datagram server connects
163to its peer, freeing the socket so
164.Nm inetd
165can received further messages on the socket, it is said to be
166a
167.Dq multi-threaded
168server, and should use the
169.Dq nowait
170entry.  For datagram servers which process all incoming datagrams
171on a socket and eventually time out, the server is said to be
172.Dq single-threaded
173and should use a
174.Dq wait
175entry.
176.Xr Comsat 8
177.Pq Xr biff 1
178and
179.Xr talkd 8
180are both examples of the latter type of
181datagram server.
182.Xr Tftpd 8
183is an exception; it is a datagram server that establishes pseudo-connections.
184It must be listed as
185.Dq wait
186in order to avoid a race;
187the server reads the first packet, creates a new socket,
188and then forks and exits to allow
189.Nm inetd
190to check for new service requests to spawn new servers.
191The optional
192.Dq max
193suffix (separated from
194.Dq wait
195or
196.Dq nowait
197by a dot) specifies the maximum number of server instances that may be
198spawned from
199.Nm inetd
200within an interval of 60 seconds. When omitted,
201.Dq max
202defaults to 40.
203.Pp
204The
205.Em user
206entry should contain the user name of the user as whom the server
207should run.  This allows for servers to be given less permission
208than root. An optional group name can be specified by appending a dot to
209the user name followed by the group name. This allows for servers to run with
210a different (primary) group id than specified in the password file. If a group
211is specified and user is not root, the supplementary groups associated with
212that user will still be set.
213.Pp
214The
215.Em server-program
216entry should contain the pathname of the program which is to be
217executed by
218.Nm inetd
219when a request is found on its socket.  If
220.Nm inetd
221provides this service internally, this entry should
222be
223.Dq internal .
224.Pp
225The
226.Em server program arguments
227should be just as arguments
228normally are, starting with argv[0], which is the name of
229the program.  If the service is provided internally, the
230word
231.Dq internal
232should take the place of this entry.
233.Pp
234.Nm Inetd
235provides several
236.Dq trivial
237services internally by use of
238routines within itself.  These services are
239.Dq echo ,
240.Dq discard ,
241.Dq chargen
242(character generator),
243.Dq daytime
244(human readable time), and
245.Dq time
246(machine readable time,
247in the form of the number of seconds since midnight, January
2481, 1900).  All of these services are tcp based.  For
249details of these services, consult the appropriate
250.Tn RFC
251from the Network Information Center.
252.Pp
253.Nm Inetd
254rereads its configuration file when it receives a hangup signal,
255.Dv SIGHUP .
256Services may be added, deleted or modified when the configuration file
257is reread.
258.Nm Inetd
259creates a file
260.Em /var/run/inetd.pid
261that contains its process identifier.
262.Sh SEE ALSO
263.Xr comsat 8 ,
264.Xr fingerd 8 ,
265.Xr ftpd 8 ,
266.Xr rexecd 8 ,
267.Xr rlogind 8 ,
268.Xr rshd 8 ,
269.Xr telnetd 8 ,
270.Xr tftpd 8
271.Sh HISTORY
272The
273.Nm
274command appeared in
275.Bx 4.3 .
276Support for
277.Em Sun-RPC
278based services is modeled after that
279provided by
280.Em Sun-OS 4.1 .
281