xref: /netbsd-src/usr.sbin/inetd/inetd.8 (revision cda4f8f6ee55684e8d311b86c99ea59191e6b74f)
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.\"     @(#)inetd.8	6.7 (Berkeley) 3/16/91
33.\"
34.Dd March 16, 1991
35.Dt INETD 8
36.Os BSD 4.3
37.Sh NAME
38.Nm inetd
39.Nd internet
40.Dq super-server
41.Sh SYNOPSIS
42.Nm inetd
43.Op Fl d
44.Op Ar configuration file
45.Sh DESCRIPTION
46.Nm Inetd
47should be run at boot time by
48.Pa /etc/rc.local
49(see
50.Xr rc 8 ) .
51It then listens for connections on certain
52internet sockets.  When a connection is found on one
53of its sockets, it decides what service the socket
54corresponds to, and invokes a program to service the request.
55After the program is
56finished, it continues to listen on the socket (except in some cases which
57will be described below).  Essentially,
58.Nm inetd
59allows running one daemon to invoke several others,
60reducing load on the system.
61.Pp
62The option available for
63.Nm inetd:
64.Bl -tag -width Ds
65.It Fl d
66Turns on debugging.
67.El
68.Pp
69Upon execution,
70.Nm inetd
71reads its configuration information from a configuration
72file which, by default, is
73.Pa /etc/inetd.conf .
74There must be an entry for each field of the configuration
75file, with entries for each field separated by a tab or
76a space.  Comments are denoted by a ``#'' at the beginning
77of a line.  There must be an entry for each field.  The
78fields of the configuration file are as follows:
79.Pp
80.Bd -unfilled -offset indent -compact
81service name
82socket type
83protocol
84wait/nowait
85user
86server program
87server program arguments
88.Ed
89.Pp
90To specify an
91.Em Sun-RPC
92based service, the entry would contain these fields.
93.Pp
94.Bd -unfilled -offset indent -compact
95service name/version
96socket type
97rpc/protocol
98wait/nowait
99user
100server program
101server program arguments
102.Ed
103.Pp
104The
105.Em service-name
106entry is the name of a valid service in
107the file
108.Pa /etc/services .
109For
110.Dq internal
111services (discussed below), the service
112name
113.Em must
114be the official name of the service (that is, the first entry in
115.Pa /etc/services ) .
116When used to specify a
117.Em Sun-RPC
118based service, this field is a valid RPC service name in
119the file
120.Pa /etc/rpc .
121The part on the right of the
122.Dq /
123is the RPC version number. This
124can simply be a single numeric argument or a range of versions.
125A range is bounded by the low version to the high version -
126.Dq rusers/1-3 .
127
128.Pp
129The
130.Em socket-type
131should be one of
132.Dq stream ,
133.Dq dgram ,
134.Dq raw ,
135.Dq rdm ,
136or
137.Dq seqpacket ,
138depending on whether the socket is a stream, datagram, raw,
139reliably delivered message, or sequenced packet socket.
140.Pp
141The
142.Em protocol
143must be a valid protocol as given in
144.Pa /etc/protocols .
145Examples might be
146.Dq tcp
147or
148.Dq udp .
149Rpc based services are specified with the
150.Dq rpc/tcp
151or
152.Dq rpc/udp
153service type.
154
155.Pp
156The
157.Em wait/nowait
158entry is applicable to datagram sockets only (other sockets should
159have a
160.Dq nowait
161entry in this space).  If a datagram server connects
162to its peer, freeing the socket so
163.Nm inetd
164can received further messages on the socket, it is said to be
165a
166.Dq multi-threaded
167server, and should use the
168.Dq nowait
169entry.  For datagram servers which process all incoming datagrams
170on a socket and eventually time out, the server is said to be
171.Dq single-threaded
172and should use a
173.Dq wait
174entry.
175.Xr Comsat 8
176.Pq Xr biff 1
177and
178.Xr talkd 8
179are both examples of the latter type of
180datagram server.
181.Xr Tftpd 8
182is an exception; it is a datagram server that establishes pseudo-connections.
183It must be listed as
184.Dq wait
185in order to avoid a race;
186the server reads the first packet, creates a new socket,
187and then forks and exits to allow
188.Nm inetd
189to check for new service requests to spawn new servers.
190.Pp
191The
192.Em user
193entry should contain the user name of the user as whom the server
194should run.  This allows for servers to be given less permission
195than root.
196.Pp
197The
198.Em server-program
199entry should contain the pathname of the program which is to be
200executed by
201.Nm inetd
202when a request is found on its socket.  If
203.Nm inetd
204provides this service internally, this entry should
205be
206.Dq internal .
207.Pp
208The
209.Em server program arguments
210should be just as arguments
211normally are, starting with argv[0], which is the name of
212the program.  If the service is provided internally, the
213word
214.Dq internal
215should take the place of this entry.
216.Pp
217.Nm Inetd
218provides several
219.Dq trivial
220services internally by use of
221routines within itself.  These services are
222.Dq echo ,
223.Dq discard ,
224.Dq chargen
225(character generator),
226.Dq daytime
227(human readable time), and
228.Dq time
229(machine readable time,
230in the form of the number of seconds since midnight, January
2311, 1900).  All of these services are tcp based.  For
232details of these services, consult the appropriate
233.Tn RFC
234from the Network Information Center.
235.Pp
236.Nm Inetd
237rereads its configuration file when it receives a hangup signal,
238.Dv SIGHUP .
239Services may be added, deleted or modified when the configuration file
240is reread.
241.Sh SEE ALSO
242.Xr comsat 8 ,
243.Xr fingerd 8 ,
244.Xr ftpd 8 ,
245.Xr rexecd 8 ,
246.Xr rlogind 8 ,
247.Xr rshd 8 ,
248.Xr telnetd 8 ,
249.Xr tftpd 8
250.Sh HISTORY
251The
252.Nm
253command appeared in
254.Bx 4.3 .
255Support for
256.Em Sun-RPC
257based services is modelled after that
258provided by
259.Em Sun-OS 4.1 .
260