作者/来源:yixinu.com
                        栏目:运维/编程
                        日期:2012-05-15 13:29:43
                xinetd控制一些系统服务的运行
	
 
xinetd 的默认配置文件 : /etc/xinetd.conf
	
 
[root@localhost ~]# cat /etc/xinetd.conf | grep -E "^[^#]"
defaults
{
	log_type	= SYSLOG daemon info 
	log_on_failure	= HOST
	log_on_success	= PID HOST DURATION EXIT
	cps		= 50 10
	instances	= 50      #  xinetd  最多唤醒的进程数
	per_source	= 10     #  同一个服务在同一个服务端最多能连接的个数
	v6only		= no
	groups		= yes
	umask		= 002
}
includedir /etc/xinetd.d
如果单个服务的配置文件中没配置这些参数 ,则使用xinetd默认的配置
	
当访问xinetd控制的进程时,xinetd拦截来访者,确认是符符合设置的条件 ,如果符合则唤醒相对应服务 的进程 ,否则禁止访问
	
当开启 xinetd 后 chkconfig 查看
[root@localhost ~]# chkconfig xinetd on [root@localhost ~]# chkconfig NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off ……………… vsftpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:off xinetd based services: chargen-dgram: off chargen-stream: off daytime-dgram: off daytime-stream: off discard-dgram: off discard-stream: off echo-dgram: off echo-stream: off rsync: off tcpmux-server: off telnet: on tftp: on time-dgram: off time-stream: off [root@localhost ~]#
	
	    下面多了一列被  xinetd  控制的服务
 
	
 
开启单个服务
[root@localhost ~]# chkconfig tftp on要重启服务只能 重启 /etc/init.d/xinetd restart ,没有单个的被xinetd控制的服务的选项
	
[root@localhost xinetd.d]# vim telnet 
# default: on
# description: The telnet server serves telnet sessions; it uses 
#       unencrypted username/password pairs for authentication.
service telnet
{
        disable = no
        flags           = REUSE
        socket_type     = stream
        wait            = no    
        user            = root    #  以root身份运行
        server          = /usr/sbin/in.telnetd     #这个服务的主进程 在 log_on_failure  += USERID
        server_args  =  -S #  这个进程带的参数 
        instances        4   #
        per_source       1   #一个ip只允许连接一个
        only_from = 192.168.0.0/24   #  允许
        no_access = 192.168.0.1     #  拒绝
 }
~ 
	
	
 
