Linux Services Organization

Our goal, introduce Linux services to the enterprise world.
Contact us in

Linux Services Organization : Linux XINETD Linux Server

The Extended Internet Services Daemon service is a TCP-wrapped super service which controls access to a subset of popular network services, including FTP, IMAP, and Telnet. The xinetd service listens for connection requests for all of the active servers with specific configuration file in the /etc/xinetd.d directory. There's also generic configuration file for xinetd services, /etc/xinetd.conf. It controls services such as rsync, gssftp, and telnet-server, when installed.


It contains general configuration settings which affect every service under xinetd's control. It is read when the xinetd service is first started, so for configuration changes to take effect, you need to restart the xinetd service:

# cat /etc/xinetd.conf

instances = 70
per_source = 15
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 30 40

includedir /etc/xinetd.d

These are some parameters that can be configured on this file to lines control the following aspects of xinetd. For more info 'man xinetd.conf'

Specifies the maximum number of simultaneous requests that xinetd can process.

Configures xinetd to use the authpriv log facility, which writes log entries to the /var/log/secure file. Adding a directive such as FILE /var/log/xinetdlog would create a custom log file called xinetdlog in the /var/log/ directory.

Configures xinetd to log failed connection attempts or if the connection was denied.

Configures xinetd to allow no more than 30 connections per second to any given service. If this limit is exceeded, the service is retired for 40 seconds.

This limits the number of connections from each IP address.

includedir /etc/xinetd.d/:
Includes options declared in the service-specific configuration files located in the /etc/xinetd.d/ directory.


It contains the configuration files for each service managed by xinetd and the names of the files related to the service. This directory is read only when the xinetd service is started, for any changes to take effect xinetd service must be restarted. as example of this file lets see the /etc/xinetd.d/telnet file installed by 'telnet-server rpm'.

# cat /etc/xinetd.d/telnet

service telnet
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no

These lines control various aspects of the telnet service. For more info 'man xinetd.conf'.

Specifies the service name, usually one of those listed in the /etc/services file.

Sets any of a number of attributes for the connection. REUSE instructs xinetd to reuse the socket for a Telnet connection.

Sets the network socket type to stream.

Specifies whether the service is single-threaded (yes) or multi-threaded (no).

Specifies which user ID the process runs under.

Group under which the server should run.

Specifies which binary executable to launch.

Host name or IP address allowed to use the server. CIDR notation (such as is okay.

Host name or IP address not allowed to use the server. CIDR notation is okay.

Specifies the time range when a particular service may be used. The time range must be stated in 24-hour format notation, HH:MM-HH:MM.

Specifies logging parameters for log_on_failure in addition to those already defined in xinetd.conf.

Specifies whether the service is disabled (yes) or enabled (no).


The following logging options are available for both /etc/xinetd.conf and the service-specific configuration files within the /etc/xinetd.d/ directory.

Logs the fact that a failed attempt was made (log_on_failure).

Logs the length of time the service is used by a remote system (log_on_success).

Logs the exit status or termination signal of the service (log_on_success).

Logs the remote host's IP address (log_on_failure and log_on_success).

Logs the process ID of the server receiving the request (log_on_success).

Logs the remote user using the method defined in RFC 1413 for all multi-threaded stream services (log_on_failure andlog_on_success).

For more info 'man xinetd.conf'.

Access control

Users of xinetd services can use the TCP Wrappers hosts access rules, provide access control via the xinetd configuration files, or a mixture of both.

Allows only the specified hosts to use the service.

Blocks listed hosts from using the service.

Specifies the time range when a particular service may be used. The time range must be stated in 24-hour format notation, HH:MM-HH:MM.

# cat /etc/xinetd.d/telnet

service telnet
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
no_access =
log_on_success += PID HOST EXIT
access_times = 09:00-17:00

In this example, when a client system from the network, such as, tries to access the Telnet service, it receives the following message:

Connection closed by foreign host.

In addition, their login attempts are logged in /var/log/messages as follows:

Jun 17 14:58:33 localhost xinetd[5285]: FAIL: telnet address from=
Jun 17 14:58:33 localhost xinetd[5283]: START: telnet pid=5285 from=
Jun 17 14:58:33 localhost xinetd[5283]: EXIT: telnet status=0 pid=5184

xinetd and TCP Wrappers

The following is the sequence of events followed by xinetd when a client requests a connection:

First: The xinetd daemon accesses the TCP Wrappers hosts access rules using a libwrap.a library call (files /etc/hosts.allow,deny). If a deny rule matches the client, the connection is dropped. If an allow rule matches the client, the connection is passed to xinetd.

Then: The xinetd daemon checks its own access control rules both for the xinetd service and the requested service. If a deny rule matches the client, the connection is dropped. Otherwise, xinetd starts an instance of the requested service and passes control of the connection to that service.

Binding and Redirection

Xinetd supports binding the service to an IP address and redirecting incoming requests for that service to another IP address, hostname, or port. The xinetd daemon is able to accomplish this redirection by spawning a process that stays alive for the duration of the connection between the requesting client machine and the host actually providing the service, transferring data between the two systems.

service telnet
socket_type = stream
wait = no
server = /usr/sbin/in.telnetd
log_on_success += DURATION USERID
log_on_failure += USERID
bind =
redirect = 23

The bind and redirect options in this file ensure that the Telnet service on the machine is bound to the external IP address (, the one facing the Internet. In addition, any requests for Telnet service sent to are redirected via a second network adapter to an internal IP address ( that only the firewall and internal systems can access. The firewall then sends the communication between the two systems, and the connecting system thinks it is connected to when it is actually connected to a different machine.

Resource Management and DoS attacks

The xinetd daemon can add a basic level of protection from Denial of Service (DoS) attacks. The following is a list of directives which can aid in limiting the effectiveness of such attacks:

Defines the maximum number of instances for a service per source IP address. It accepts only integers as an argument and can be used in both xinetd.conf and in the service specific configuration files in the xinetd.d directory.

Defines the maximum number of connections per second. This directive takes two integer arguments separated by white space. The first argument is the maximum number of connections allowed to the service per second. The second argument is the number of seconds that xinetd must wait before re-enabling the service. It accepts only integers as arguments and can be used in either the xinetd.conf file or the service-specific configuration files in the xinetd.d/ directory.

Defines the CPU usage or load average threshold for a service. It accepts a floating point number argument. The load average is a rough measure of how many processes are active at a given time. See the uptime, who, and procinfo commands for more information about load average. There are more resource management options available for xinetd. Refer to the xinetd.conf man page for more information.

Managing xinetd services

Some standard Linux services are designed to be executed through xinetd. For example 'rsync' server, installed by rsync RPM, is configured and executed through the xinetd service using /etc/xinetd.d/rsync

The first step in order to run rsync server through xinetd is the RPM installation.

# yum install rsync

Next step is active the rsync server on xinetd service. This can be done writing the directive 'disable = no' into /etc/xinetd.d/rsync file and restarting the xinetd service. The command chkconfig can do both steps automatically :

# chkconfig rsync on

Finally verify the xinetd is listening on port TCP/IP 873, rsync server port:

# netstat -putan | grep 873
tcp ... :::873 ... xinetd/2234


1.- xinetd superserver is installed by default on RHEL6 by xinetd RPM (true/false).

2.- The command 'chkconfig' can be used to enable/disable installed services on xinetd (true/false).

3.- Once actived a xinetd service through chkconfig command is necessary restart the xinetd service to in order to take effect the changes applied (true/false).

4.- The xinetd service does not use TPC-Wrappers in order to secure the services (true/false).

5.- By default xinetd service in not protected by SElinux running on targered policy (true/false).

6.- Which command can be used in order to list the status of all the xinetd services.

7.- Which xinetd configuration parameter can be used in order to limit to 20 the maximum number of connections from the same client to a network service managed through xinetd service can be used?

8.- Which xinetd configuration parameter can be used in order to limit the number of connections per second that a network service executed through xinetd service is going to accept.

9.- Which of the following is the generic xinetd configuration file?

A - /etc/xinetd.d/xinetd.conf
B - /etc/xinetd.d
C - /etc/xinetd.conf
D - /etc/xinet.conf

10.- Which of the following commands can be used to enable 'rsync' xinetd service?

A - enablexinetd rsync on
B - chkconfig rsync on
C - chkconfig rsync off
D - xinetd rsync on


1.- Install and configure telnet service through xinetd on rhel6 server. Create 'john' account and test the telnet connection from node01 ( to rhel6 ( using john account.

2.- Configure telnet service on lab1 to limit to one simultaneous connection from each client to rhel6 telnet server.

3.- Configure telnet service on lab1 to accept connection only at work hours (09:00-17:00).

-- This page is part of Linux Server online tutorial --