/etc/inetd.conf ファイルには、要求に応じて起動するサーバとサーバの使うポート番号が書かれています。inetd コマンドはここで書かれたすべてのポートをリッスンします。さらに、inetd はポートに対する接続を検出したら、対応するサーバプログラムを実行します。
/etc/inetd.conf ファイルの有効な各行は (空白で区切られた) 7 つのフィールドで 1 つのサーバを表現します。各フィールドの意味は以下の通りです。
/etc/services ファイルに含まれる情報を使って標準的なポート番号に置換されます)。
stream、UDP データグラムの場合 dgram を指定します。
tcp, tcp6, udp, or udp6.
wait または nowait の 2 種類です。これらの値を使って、inetd に対して他の接続を受け入れる前に既に起動中のプロセスの終了を待つ (wait) か待たない (nowait) かを指定します。簡単に多重送信対応できる TCP 接続の場合、通常 nowait を使います。UDP を使って応答するプログラムに対しては、サーバが複数接続の並列化を管理する機能を持っている場合に限り nowait を使うべきです。この後にピリオドで区切りながら子プロセスの最大数、さらに 1 分間に認められる接続の最大数 (デフォルトの値は 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.