/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.