3.6. Adding a New Service (inetd)
Problem
You want to add a new network service, controlled by inetd .
Solution
Add a new line to /etc/inetd.conf of the form:
SERVICE_NAME SOCKET_TYPE PROTOCOL THREADING USER /PATH/TO/SERVER ARGSThen signal inetd to reread /etc/inetd.conf. [Recipe 3.4]
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, orseqpacket.Protocol. Typically
tcporudp.Threading . Use
waitfor single-threaded, ornowaitfor 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.
See Also
inetd(8), inetd.conf(5), services(5).
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access