一、
启动xinetd服务前,首先确认您是否安装了xinetd。如果没有安装xinetd服务,/etc/xinetd.d/目录下只有两个文件。
[root@localhost xinetd.d]# ls
rsync telnet.rpmsave
输入以下命令安装xinetd服务
[root@localhost xinetd.d]# yum install -y xinetd
Repository base is listed more than once in the configuration
Setting up Install Process
Package 2:xinetd-2.3.14-40.el6.x86_64 already installed and latest version
Nothing to do
因为我已经安装过了,所以他提示 Nothing to do。安装完成之后,再查看/etc/xinetd.d/文件夹,你就会发现那里面多了很多文件。这些文件就是您需要的服务啦!
[root@localhost /]# cd /etc/xinetd.d/
[root@localhost xinetd.d]# ls
chargen-dgram daytime-stream echo-dgram tcpmux-server time-stream
chargen-stream discard-dgram echo-stream telnet.rpmsave
daytime-dgram discard-stream rsync time-dgram
二、修改配置文件
这里我们就以/etc/xinetd.d/rsync服务为例,给大家做详细的讲解。
为了检测服务是否开启,在启动服务之前,我们先监听一下rsync服务是否启动
[root@localhost /]# ss -tal|grep ssync
[root@localhost /]#
很显然,没有结果。
接下来我们修改配置文件。
[root@localhost /]# cd /etc/xinetd.d/
[root@localhost xinetd.d]# cat rsync
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = yes -----------将yes改为no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
修改disable行的yes为no
再监听一下,有结果了!
[root@localhost xinetd.d]# ss -tal|grep rsync
LISTEN 0 64 :::rsync :::*
三、重启服务
[root@localhost xinetd.d]# service xinetd start
Starting xinetd:
重启服务,这样的话以后再开机之后该服务就可以实现开机自动挂在啦!
四、简单方法!
其实啊,还有一种更简单直接的方法!确认你要启动的xinetd服务之后,可以跳过第二步、第三步。代码如下:
[root@localhost xinetd.d]# chkconfig rsync on
[root@localhost xinetd.d]# ss -tal|grep rsync
LISTEN 0 64 :::rsync :::*
看完第四步之后,你一定想打我吧 (ૢ˃ꌂ˂ૢ)。个人推荐直接用第四种!