/etc/inetd.conf
文件列出服务器及其通用的端口号。inetd
命令侦测它们;若发现任何端口号已被链接,则运行对应的程序。
/etc/inetd.conf
文件中的每列条目以 7 个字段 (以空格区分) 描述服务器:
/etc/services
文件中包含的信息映射到标准端口号)。
stream
用于TCP 连接, dgram
用于UDP 数据包。
tcp
, tcp6
, udp
, or udp6
.
wait
或 nowait
,告诉 inetd
在接受另一个链接时,是否等待或终止已启用的进程。对 TCP 链接而言,可使用 nowait
,进入多任务。对回应 UDP 的程序而言,只在服务器可平行管理多个链接时,才使用 nowait
。可在这个字段前加上圆点,以及每分钟可以开启的最大链接量 (缺省为 256)。
user.group
syntax.
argv[0]
)。
例 9.1. 摘自 /etc/inetd.conf
#:BSD: Shell, login, exec and talk are BSD protocols. talk dgram udp wait nobody.tty /usr/sbin/in.talkd in.talkd ntalk dgram udp wait nobody.tty /usr/sbin/in.ntalkd in.ntalkd #:INFO: Info services ident stream tcp nowait nobody /usr/sbin/nullidentd nullidentd finger stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/in.fingerd
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.