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:
- 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). - Socket type . Either
stream, dgram,
raw, rdm, or
seqpacket. - Protocol . Typically tcp or
udp. - Threading
. Use
wait for single-threaded, or
nowait for multithreaded. - User . The service will run as this user.
- Path to server executable.
- 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).