Networking Service Daemons

Networking Service Daemons

As a quick review of how networking services (as well as other services) are started in Red Hat Linux, the two main directories containing files that define how services are started are:

  • /etc/xinetd.d:???contains configuration files used by the xinetd daemon

  • /etc/init.d:???contains start-up scripts that are linked to /etc/rc?.d directories so they can be started at different run levels

Each of these methods for handling network services is described in the following sections.

Note?

Some Red Hat Linux configuration tools also store configuration information in the /etc/sysconfig directory. For example, there are configuration files for ipchains and sendmail in /etc/sysconfig. If you search the scripts in the /etc/init.d directory for the word sysconfig, you will see just how many services look in that directory for configuration information.

The xinetd super-server

The xinetd daemon is referred to as the super-server. It listens for incoming requests for services based on information in separate files in the /etc/xinetd.d directory. When a request for a service is received by the xinetd daemon (for a particular network port number), xinetd typically launches a different daemon to handle the request. So instead of having separate daemons running for every network service, only the xinetd daemon needs to run — plus an additional daemon process for each service currently in use.

To see if a particular service handled by xinetd is on or off, go to the /etc/xinetd.d directory and open the file representing that service with a text editor. A default line at the top of the file indicates whether or not the service is on or off by default. The disable line actually sets whether or not the service is currently disabled. The following is an example from the /etc/xinetd.d/ipop3 file:

# default: off
# description: The POP3 service allows remote users to access their mail \
#             using an POP3 client such as Netscape Communicator, mutt, \
#             or fetchmail.

service pop3{
       socket_type      = stream
       wait             = no
       user             = root
       server           = /usr/sbin/ipop3d
       log_on_success   += HOST DURATION
       log_on_failure   += HOST
       disable          = yes
}

In this example, the ipop3 configuration file represents a Post Office Protocol (POP) version 3 service. By default, the service is turned off. When the service is on, a request to the xinetd server daemon for a POP3 service from the network is handed to the /usr/sbin/ipop3d daemon. The ipop3d daemon, in turn, handles the remote user's request to download his or her e-mail from this Linux system that is acting as a POP3 server.

To enable a service in an /etc/xinetd.d file, edit the file using any text editor as the root user. Turning on the service is as easy as changing the disable option from yes to no and restarting the xinetd daemon. For example, you could change the line in the /etc/xinetd.d/ipop3 so that it appears as follows:

disable     =  no

Then you could restart the xinetd daemon as follows:

# /etc/init.d/xinetd restart

In this case, you could look in the /etc/services file and see that POP3 services are (by default) received on port number 110 for TCP/IP networks. So, any request that comes into your computer for port 110 is first directed to the xinetd daemon, then handled by the ipop3d daemon. If authentication is correct, e-mail is downloaded to the user's mailbox (typically /var/spool/mail/user, where user represents the user's name).

Cross-Reference?

The xinetd super-server is described in Chapter 12.

The init.d start-up scripts

Network services that are not available via the xinetd daemon are typically handled by scripts in the /etc/init.d directory. For a script in the /etc/init.d directory to activate a service, it must be linked to a file in one of the run-level directories (/etc/rc?.d) that begins with the letter "S" followed by a two-digit number.

For example, the script for starting the print service daemon (/etc/init.d/lpd) is linked to the file S60lpd in the /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, and /etc/rc5.d directories. In that way, the print service is started when Red Hat Linux is running in initialization states 2, 3, 4, or 5.

Cross-Reference?

See Chapter 12 for more details on run levels and start-up scripts.

For the most part, system administrators are not expected to modify these start-up scripts. However, to have a service turned on or off for a particular run level, change the script to a filename that begins with an S (start) to one that begins with a K (kill). You can easily do this with the chkconfig command or the Service Configuration window. To start that window, type serviceconf from a Terminal window while you are logged in as the root user.

Start-up scripts typically start one or more daemon processes that represent a particular service. To add options to a particular daemon, you typically don't have to edit the start-up script directly. Instead, look for configuration files in the /etc/sysconfig directory. For example, daemons options representing the DNS (named), Samba (smbd and nmbd), and system logging (syslogd) services have options files in the /etc/sysconfig directory.




Part IV: Red Hat Linux Network and Server Setup