Spawning Internet Daemons with inetd
All Linux distributions (and all Berkeley-style Unix variants for that matter) include a central network service utility controlled by the inetd process. This "super-server" acts as the clearinghouse, or central point of administration, for all Internet services running on the server. You can verify that the master inetd process is running on your system by entering the following command:
[ramon]$ ps aux | grep inetd root 421 0.0 0.0 1232 60 ? S Sep24 0:00 inetd
The inetd daemon is started by Linux at system startup, and it immediately listens for the network ports listed in the /etc/inetd.conf file, the main configuration file for the inetd daemon (more on that in the next section). If an incoming request matches a network port number specified in its configuration, inetd assigns the appropriate listener application to the incoming socket and continues to listen for future connections. This is done in order to optimize system resources, because having a single process listen for several ports represents a lighter load on the system than having each process listen on its own port.
The only inetd command-line option of interest is -d. This option starts the daemon with debugging enabled, as in the following command:
Note that you have to stop the inetd daemon manually (because it gets started by default), and then re-invoke it with the debug option enabled, as shown in Listing 4.1.
Listing 4.1 Execution of inetd with the debug option enabled
[ramon]$ sudo killall inetd [ramon]$ sudo /usr/sbin/inetd -d
ADD : ftp proto=tcp, wait.max=0.40, user.group=root.(null)^ builtin=0 server=/usr/sbin/tcpd
ADD : telnet proto=tcp, wait.max=0.40, user.group=root.(null)^ builtin=0 server=/usr/sbin/tcpd
ADD : login proto=tcp, wait.max=0.40, user.group=root.(null)^ builtin=0 server=/usr/sbin/tcpd someone wants telnet accept, ctrl 3
24257 execl /usr/sbin/tcpd
24257 reaped someone wants ftp accept, ctrl 3
24259 execl /usr/sbin/tcpd
24259 reaped someone wants pop-3
accept, ctrl 3
24261 execl /usr/sbin/tcpd
PART 2
Keep in mind that, when invoked with the -d option, inetd displays its diagnostics to the stderr process (the controlling tty by default), making this option useful only when you're trying to troubleshoot a problem. Listing 4.1 shows a debug session during which three requests are received (telnet, ftp, and pop-3).
The next section discusses /etc/inetd.conf, the configuration file used by the inetd daemon.
Continue reading here: Inetd Configuration Examples
Was this article helpful?