xref: /netbsd-src/usr.sbin/inetd/inetd.8 (revision 0b9f50897e9a9c6709320fafb4c3787fddcc0a45)
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.3 1993/08/01 07:24:56 mycroft 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
86user
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
100user
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.
191.Pp
192The
193.Em user
194entry should contain the user name of the user as whom the server
195should run.  This allows for servers to be given less permission
196than root.
197.Pp
198The
199.Em server-program
200entry should contain the pathname of the program which is to be
201executed by
202.Nm inetd
203when a request is found on its socket.  If
204.Nm inetd
205provides this service internally, this entry should
206be
207.Dq internal .
208.Pp
209The
210.Em server program arguments
211should be just as arguments
212normally are, starting with argv[0], which is the name of
213the program.  If the service is provided internally, the
214word
215.Dq internal
216should take the place of this entry.
217.Pp
218.Nm Inetd
219provides several
220.Dq trivial
221services internally by use of
222routines within itself.  These services are
223.Dq echo ,
224.Dq discard ,
225.Dq chargen
226(character generator),
227.Dq daytime
228(human readable time), and
229.Dq time
230(machine readable time,
231in the form of the number of seconds since midnight, January
2321, 1900).  All of these services are tcp based.  For
233details of these services, consult the appropriate
234.Tn RFC
235from the Network Information Center.
236.Pp
237.Nm Inetd
238rereads its configuration file when it receives a hangup signal,
239.Dv SIGHUP .
240Services may be added, deleted or modified when the configuration file
241is reread.
242.Sh SEE ALSO
243.Xr comsat 8 ,
244.Xr fingerd 8 ,
245.Xr ftpd 8 ,
246.Xr rexecd 8 ,
247.Xr rlogind 8 ,
248.Xr rshd 8 ,
249.Xr telnetd 8 ,
250.Xr tftpd 8
251.Sh HISTORY
252The
253.Nm
254command appeared in
255.Bx 4.3 .
256Support for
257.Em Sun-RPC
258based services is modelled after that
259provided by
260.Em Sun-OS 4.1 .
261