/etc/inetd.conf перечисляются эти серверы и обычно используемые ими порты. Команда inetd слушает их все; когда она обнаруживает соединение с любым таким портом, она запускает соответствующую серверную программу.
/etc/inetd.conf описывает сервер в сми полях (разделённых пробелами):
/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.