How to install and configure xinetd

Home > Search > How-to
  by

Use apt-get or yum to install xinetd.

[root@server1 ~]# apt-get install xinetd
[root@server1 ~]# yum install xinetd

 

Xinetd (extended Internet daemon) is a service that listens for network connections for other daemons. For example, xinetd may listen for HTTP connections for the Apache deamon. One advantage is that numerous services do not need to be actively listening for connections from a foreign host. Instead, only the xinetd deamon needs to listen, and when a request comes in from a foreign host for one of the deamons on the server, xinetd will then start the necessary service.

Xinetd replaced Inetd (Internet daemon). Inetd is no longer found in most modern distributions, and has mostly been replaced with xinetd.

Systemctl can be used to start, restart, stop, and check the status of xinetd.

[root@server1 ~]# systemctl start xinetd
[root@server1 ~]# systemctl restart xinetd
[root@server1 ~]# systemctl stop xinetd
[root@server1 ~]# systemctl status xinetd

 

The xinetd configuration file is located at /etc/xinetd.conf. The /etc/xinetd.conf file contains the system wide settings. At the very end of the /etc/xinetd.conf file is the following line. This line tells xinetd to also use files in the /etc/xinetd.d/ directory.

includedir /etc/xinetd.d

 

Files in the /etc/xinetd.d/ directory are used to control how a daemon uses xinetd. For example, if the FTP deamon will use xinetd, there will be a file in the /etc/xinetd.d/ directory for the FTP daemon. 

Following is an example of the /etc/xinetd.d/rsync file. 

# This is the tcp version
service rsync
{
    disabled     = yes
    socket_type  = stream
    protocol     = tcp
    user         = root
    wait         = no
    server       = /usr/bin/rsync
}

# This is the udp version
service rsync
{
    disabled     = yes
    socket_type  = dgram
    protocol     = udp
    user         = root
    wait         = yes
    server       = /usr/bin/rsync
}

 

In the prior example, notice there are two sections, one for TCP and one for UDP. This is very common.

  • service = The name of the service as it appears in the /etc/services file (rsync in this example)
  • disabled = Yes means that xinetd will be used for the service. No means that xinetd will not be used for the service. By default, most services have disabled set to yes.
  • socket_type = stream, dgram, or raw. Stream is typically used when protocol is TCP, and dgram is typically used when protocol is UDP.
  • protocol = TCP or UDP
  • wait = no will be used if socket_type is stream or raw. Yes or no can be used if socket_type is dgram.
  • user = User account use, such as root, nobody, or user1.
  • server = path to the service of the server

Xinetd is not limited to only these parameters. There are a variety of parameters that can be used, and each file in the /etc/xinetd.d/ directory can have it's own unique set of parameters. Following are some additional parameters you may want to use.

  • only_from = IP addresses, network address, or computers that are allowed, separated by a space. Only those listed will be allowed.
  • no_access = IP addresses, network address, or computers that are denied, separated by a space. Only those listed will be denied.
  • access_time = sets the time when the deamon can be accessed, such as 7:00 - 19:00. If a session is started in this time, the session can go outside of the period.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments