22.2.5 配置inetd

来源:互联网 发布:catia软件功能 编辑:程序博客网 时间:2024/06/08 06:23

22.2.5  配置inetd

xinetd类似,inetd的配置文件是/etc/inetd.conf。在参数的个数上,inetd要比xinetd少很多,因此每个服务只需要一行就足够了。下面是从/etc/inetd.conf中截取的一部分配置信息。

 

#echo       stream   tcp     nowait   root    internal

#echo       dgram    udp     wait    root    internal

...

ident       stream   tcp     wait    identd    /usr/sbin/identd    identd

swat        stream   tcp     nowait.400 root    /usr/sbin/swat    swat

finger      stream   tcp     nowait    nobody    /usr/sbin/tcpd    in.fingerd -w

...

 

各个字段从左至右依次表示:

q      服务名称。和xinetd一样,inetd通过查询/etc/service获得该服务的相关信息。

q      套接口类型。TCPstreamUDPdgram

q      该服务使用的通信协议。

q      inetd是否等到守护进程结束才继续接管端口。wait表示等待(相当于xinetdwait = yes),nowait表示不等待,inetd每次接到一个请求就启动守护进程的新副本(相当于xinetdwait = no)。

q      运行该守护进程的用户身份。

q      守护进程二进制文件的完整路径及其命令行参数。和xinetd不同,inetd要求把服务器命令作为第一个参数(例如in.fingerd),然后才是真正意义上的“命令行参数”(例如-w)。关键字internal表示服务的实现由inetd自己实现。

完成对/etc/inetd.conf的编辑后,需要给inetd发送一个HUP信号,通知其重新读取配置文件。

 

$ ps aux | grep inetd                            ##查找inetd的进程号

root      4414  0.0  0.1   1908   428 ?        S    13:38   0:00 /usr/sbin/inetutils-inetd

lewis     5186  0.0  0.3   3216   772 pts/0    R+   13:39   0:00 grep inetd

$ sudo kill -HUP 4414                        ##发送HUP信号

原创粉丝点击