/etc/inetd.conf
文件列出这些服务和他们常用的端口。 inetd
命令监听列出的所有端口;当探测到任意其中端口的连接,它就运行相应的服务程序。
/etc/inetd.conf
文件中每行通过七个区段(有空格分开)描述一个服务:
/etc/services
文件中包含的信息映射到标准端口号)。
stream
用于TCP 连接, dgram
用于UDP 数据包。
tcp
或 udp
。
wait
or nowait
, to tell inetd
whether it should wait or not for the end of the launched process before accepting another connection. For TCP connections, easily multiplexable, you can usually use nowait
. For programs responding over UDP, you should use nowait
only if the server is capable of managing several connections in parallel. You can suffix this field with a period, followed by the maximum number of connections authorized per minute (the default limit is 256).
argv[0]
)。
例 9.1. 摘自 /etc/inetd.conf
talk dgram udp wait nobody.tty /usr/sbin/in.talkd in.talkd finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd ident stream tcp nowait nobody /usr/sbin/identd identd -i
tcpd
program is frequently used in the /etc/inetd.conf
file. It allows limiting incoming connections by applying access control rules, documented in the hosts_access(5) manual page, and which are configured in the /etc/hosts.allow
and /etc/hosts.deny
files. Once it has been determined that the connection is authorized, tcpd
executes the real server (like in.fingerd
in our example). It is worth noting that tcpd
relies on the name under which it was invoked (that is the first argument, argv[0]
) to identify the real program to run. So you should not start the arguments list with tcpd
but with the program that must be wrapped.