inetd - internet super-server
inetd [-ds] [-L seconds] [-R rate] [configuration_file]
The inetd(1) program listens for connections on certain internet sockets. When a connection is found on one of its sockets, it decides what service the socket corresponds to and invokes a program to service the request. The server program is invoked with the service socket as its standard input, output, and error descriptors. After the program is finished, inetd(1) continues to listen on the socket (except in some cases that will be described later in this topic). The inetd(1) program allows running one daemon to invoke several others, reducing load on the system.
The inetd(1) daemon is run by init(1) shortly after the Interix subsystem starts.
The options available for inetd(1) are:
Upon execution, inetd(1) reads its configuration information from a configuration file; if the configuration_file argument is omitted, information is taken from /etc/inetd.conf. There must be an entry for each field of the configuration file, with entries for each field separated by a tab or a space. Comments are denoted by a number sign (#) at the beginning of a line. There must be an entry for each field. The fields of the configuration file are as follows:
[camp-]name sock_type protocol wait user serv_prog serv_prog_args
The camp- disables the service identified by name, but blocks access to the default port used by the service. Use this to prevent a trojan horse program from using the port.
There are two types of services that inetd(1) can start: standard and TCPMUX. A standard service has a well known port assigned to it. It can be either a service that implements an official Internet standard or a Berkeley Software Distribution (BSD)-specific service. As described in RFC 1078, TCPMUX services are nonstandard services that do not have a well known port assigned to them. They are invoked from inetd(1) when a program connects to the tcpmux well known port and specifies the service name. This feature is useful for adding locally developed servers.
Servers using stream sockets generally are multi-threaded and use the nowait entry. Connection requests for these services are accepted by inetd(1), and the server is given only the newly accepted socket connected to a client of the service. Most stream-based services operate in this manner. Stream-based servers that use wait are started with the listening service socket, and must accept at least one connection request before exiting. Such a server would normally accept and process incoming connection requests until a time-out. TCPMUX services must use nowait.
The inetd(1) program provides several trivial services internally by use of routines within itself. These services are echo, discard, chargen (character generator), daytime (human readable time), and time (machine readable time, in the form of the number of seconds since midnight, January 1, 1900). All of these services are TCP based. For details of these services, consult the appropriate RFC from the Network Information Center.
The inetd(1) program rereads its configuration file when it receives a hangup signal, SIGHUP. Services can be added, deleted, or modified when the configuration file is reread.
RFC 1078 describes the TCPMUX protocol:
"A TCP client connects to a foreign host on TCP port 1. It sends the service name, followed by a carriage-return line-feed <CRLF>. The service name is never case sensitive. The server replies with a single character indicating positive (+) or negative (-) acknowledgment, immediately followed by an optional message of explanation, terminated with a <CRLF>. If the reply was positive, the selected protocol begins; otherwise, the connection is closed."
The TCP connection is passed to the program as file descriptors 0 and 1.
If the TCPMUX service name begins with a plus sign (+), inetd(1) returns the positive reply for the program. This allows you to invoke programs that use stdin/stdout without putting any special server code into them.
The special service name help causes inetd(1) to list TCPMUX services in inetd.conf.
Here are several example service entries for the various types of services:
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
ntalk dgram udp wait root /usr/libexec/ntalkd ntalkd
tcpmux/+date stream tcp nowait guest /bin/date date
tcpmux/phonebook stream tcp nowait guest /usr/local/bin/phonebook phonebook
The inetd(1) server logs error messages using syslog(3); you might want to start syslogd(1). Important error messages and their explanations are:
The telnetd(1) daemon must be started with the -i option to run from inetd(1).
By default, the Interix telnetd and ftpd daemons are disabled because equivalent services are available as Windows services. Before running the Interix daemons, you must stop the equivalent Windows services.
inetd.conf(5)
fingerd(1)
ftpd(1)
ntalkd(1)
rexecd(1)
rlogind(1)
rshd(1)
service(1)
telnetd(1)
accept(2)
bind(2)
connect(2)
listen(2)
socket(2)