[ Team LiB ] Previous Section Next Section

Recipe 3.6 Adding a New Service (inetd)

3.6.1 Problem

You want to add a new network service, controlled by inetd .

3.6.2 Solution

Add a new line to /etc/inetd.conf of the form:

SERVICE_NAME  SOCKET_TYPE  PROTOCOL  THREADING  USER  /PATH/TO/SERVER  ARGS

Then signal inetd to reread /etc/inetd.conf. [Recipe 3.4]

3.6.3 Discussion

The values on the line are:

  1. Service name. A service listed in /etc/services. If it's not, add an entry by selecting a service name, port number, and protocol. See services(5).

  2. Socket type. Either stream, dgram, raw, rdm, or seqpacket.

  3. Protocol. Typically tcp or udp.

  4. Threading . Use wait for single-threaded, or nowait for multithreaded.

  5. User. The service will run as this user.

  6. Path to server executable.

  7. Server arguments, separated by whitespace. You must begin with the zeroth argument, the server's basename itself. For example, for /usr/sbin/in.telnetd, the zeroth argument would be in.telnetd.

A full example is:

telnet  stream  tcp  nowait  root  /usr/sbin/in.telnetd  in.telnetd

A line in inetd.conf may contain a few other details as well, specifying buffer sizes, a local host address for listening, and so forth. See the manpage.

3.6.4 See Also

inetd(8), inetd.conf(5), services(5).

    [ Team LiB ] Previous Section Next Section