INETD(8) BSD System Manager's Manual INETD(8)
NAME
inetd -- internet ``super-server''
SYNOPSIS
inetd [-di] [-q queuelength] [configuration file(1,n)]
DESCRIPTION
Inetd should be run at boot time(1,2,n) by /etc/rc.local (see rc(8)). If your
init(8) can respawn arbitrary daemons, inetd can be run from init
instead; then init will restart it if(3,n) it crashes. You must use the -i
option to prevent inetd from backgrounding itself, or init will become
confused.
When running, inetd listens for connections on certain internet sockets.
When a connection is found on one of its sockets, it looks up what ser-
vice the socket(2,7,n) corresponds to, and invokes a program to service the
request. After the program is finished, it will continue to listen(1,2,7) on the
socket(2,7,n), except in(1,8) some special cases which will be described below.
Essentially, inetd allows running one daemon to invoke several others,
reducing load(7,n) on the system.
OPTIONS
The options available for inetd:
-d Turns on several kinds of debugging and make inetd behave if(3,n) run
in(1,8) a debugger. Also implies -i.
-i Do not background; for running from init(8).
-q queuelength
Sets the size of the socket(2,7,n) listen(1,2,7) queue(1,3) to the specified value.
Default is 128.
CONFIGURATION
Upon execution, inetd reads its configuration information from a configu-
ration file(1,n) which, by default, is /etc/inetd.conf. There must be an
entry for each field of the configuration file(1,n), with entries for each
field separated by a tab or a space. Comments are denoted by a ``#'' at
the beginning of a line. There must be an entry for each field. The
fields of the configuration file(1,n) are as follows:
service name[@hostname]
socket(2,7,n) type
protocol
wait/nowait[.max]
user[.group]
server program
server program arguments
To specify an Sun-RPC based service, the entry would contain these
fields.
service name/version(1,3,5)[@hostname]
socket(2,7,n) type
rpc(3,5,8)/protocol
wait/nowait[.max]
user[.group]
server program
server program arguments
The service-name entry is the name of a valid service in(1,8) the file(1,n)
/etc/services. For ``internal'' services (discussed below), the service
name must be the official name of the service (that is, the first entry
in(1,8) /etc/services). When used to specify a Sun-RPC based service, this
field is a valid RPC service name in(1,8) the file(1,n) /etc/rpc(3,5,8). The part on the
right of the ``/'' is the RPC version(1,3,5) number. This can simply be a single
numeric argument or a range of versions. A range is bounded by the low
version(1,3,5) to the high version(1,3,5) - ``rusers/1-3''.
If a string(3,n) of the form @hostname is appended to the service, it causes
inetd to bind(2,n,1 builtins) to the port for the service on only the specific IP address
associated with hostname, instead of listening on all available
addresses. This can be done as many times as desired for different
addresses, which permits setting up ``virtually hosted'' services. Note,
however, that while you can listen(1,2,7) to as many specific addresses as you
want, kernel restrictions prevent inetd from listening to the same port
on a specific address and the general address at once. hostname should
be a resolvable hostname or an IP address associated with one of the
interfaces of the local system.
The socket-type should be one of ``stream'', ``dgram'', ``raw(3x,7,8,3x cbreak)'', ``rdm'',
or ``seqpacket'', depending on whether the socket(2,7,n) is a stream, datagram,
raw(3x,7,8,3x cbreak), reliably delivered message, or sequenced packet socket.
The protocol must be a valid protocol as given in(1,8) /etc/protocols. Exam-
ples might be ``tcp'' or ``udp''. Rpc based services are specified with
the ``rpc(3,5,8)/tcp'' or ``rpc(3,5,8)/udp'' service type.
The wait/nowait entry is applicable to datagram sockets only (other sock-
ets should have a ``nowait'' entry in(1,8) this space). If a datagram server
connects to its peer, freeing the socket(2,7,n) so inetd can received further
messages on the socket(2,7,n), it is said to be a ``multi-threaded'' server, and
should use the ``nowait'' entry. For datagram servers which process all
incoming datagrams on a socket(2,7,n) and eventually time(1,2,n) out, the server is
said to be ``single-threaded'' and should use a ``wait'' entry.
Comsat(8) (biff(1)) and talkd(8) are both examples of the latter type of
datagram server. Tftpd(8) is an exception; it is a datagram server that
establishes pseudo-connections. It must be listed as ``wait'' in(1,8) order
to avoid a race; the server reads the first packet, creates a new socket(2,7,n),
and then forks and exits to allow inetd to check for new service requests
to spawn new servers. The optional ``max'' suffix (separated from
``wait'' or ``nowait'' by a dot) specifies the maximum number of server
instances that may be spawned from inetd within an interval of 60 sec-
onds. When omitted, ``max'' defaults to 40.
The user entry should contain the user name of the user as whom the
server should run. This allows for servers to be given less(1,3) permission
than root. An optional group name can be specified by appending a dot to
the user name followed by the group name. This allows for servers to run
with a different (primary) group id than specified in(1,8) the password file.
If a group is specified and user is not root, the supplementary groups
associated with that user will still be set.
The server-program entry should contain the pathname of the program which
is to be executed by inetd when a request is found on its socket. If
inetd provides this service internally, this entry should be
``internal''.
The server program arguments should be just as arguments normally are,
starting with argv[0], which is the name of the program. If the service
is provided internally, the word ``internal'' should take the place of
this entry.
BUILTINS
Inetd provides several ``trivial'' services internally by use of routines
within itself. These services are ``echo(1,3x,1 builtins)'', ``discard'', ``chargen''
(character generator), ``daytime'' (human readable time(1,2,n)), and ``time(1,2,n)''
(machine readable time(1,2,n), in(1,8) the form of the number of seconds since mid-
night, January 1, 1900). All of these services are tcp based. For
details of these services, consult the appropriate RFC from the Network
Information Center.
Inetd rereads its configuration file(1,n) when it receives a hangup signal(2,7),
SIGHUP. Services may be added, deleted or modified when the configura-
tion file(1,n) is reread. Inetd creates a file(1,n) /var/run/inetd.pid that con-
tains its process identifier.
SEE ALSO
comsat(8), fingerd(8), ftpd(8), rexecd(8), rlogind(8), rshd(8),
telnetd(8), tftpd(8)
HISTORY
The inetd command appeared in(1,8) 4.3BSD. Support for Sun-RPC based services
is modelled after that provided by SunOS 4.1.
Linux NetKit (0.17) August 22, 1999 Linux NetKit (0.17)