Inetd and Xinetd: The Programs That Start Network Services on Demand
A network service doesn't always need its own program waiting around for a connection. Inetd can listen on behalf of several services and start the appropriate program when a request arrives.
That's why inetd is called an internet superserver. It's a background program used on Unix and Unix-like operating systems, a family that includes Linux and BSD systems.
Despite the name, its services can be limited to a local network; they don't have to be reachable from the public internet.
Linux in 100 Seconds
What happens when a request arrives
A service is a function offered to other computers, such as transferring files. A network port is a numbered destination that helps a computer direct traffic to the right service.
The OpenBSD inetd manual describes the basic arrangement:
- Inetd listens at the configured network endpoints, called sockets.
- A request arrives, and inetd selects the matching service program.
- That program handles the work, while inetd manages listening according to the service's configuration.
The service program may exit after its work ends. Inetd doesn't simply switch off every service after each request: some programs handle multiple requests, and some small services can be handled inside inetd itself.
This arrangement reduces the need to keep separate service programs idle in memory. The exact savings depend on the services and how they're used.
Xinetd is a separate replacement
Xinetd follows the same broad superserver idea, with its own configuration format and controls. The project describes it as a replacement for inetd, rather than merely a newer version of the same program.
Its settings can restrict which remote computers may connect, record activity, and limit how many service instances run at once. An instance is a running copy of a program.
The xinetd configuration manual documents controls such as only_from for permitted sources and cps for the incoming connection rate. Those controls need suitable settings; the program's presence isn't proof that access is restricted.
Inetd implementations can also offer controls of their own. OpenBSD's version, for example, supports limits on how often a service starts and lets it run with fewer permissions than the system's all-powerful root account.
- Finally understand what the commands you type are doing behind the scenes.
- Fix problems yourself instead of pasting in fixes you found online and hoping.
- Go from following tutorials to knowing why they work, one clear chapter at a time.
Starting a service doesn't secure its traffic
Neither arrangement automatically encrypts the communication handled by the service. Encryption is the process that makes data unreadable without the appropriate key.
For example, standard FTP, the File Transfer Protocol, sends passwords and data without encryption, as the FTP security guidance explains. Starting an FTP server through xinetd doesn't change that protocol behavior.
If you're reviewing an existing machine, examine the services it exposes, the program each entry starts, and the permissions and access restrictions applied. Disable services that aren't needed through the system's supported configuration process.
The idea continues in socket activation
Systemd, a system and service manager used by many Linux systems, supports a related approach called socket activation. It can listen for traffic and start a matching service when needed.
Its socket documentation describes both native support and compatibility with inetd-style programs. Depending on the settings, it can start one service for the listening socket or a separate instance for each connection.
For troubleshooting, that means a service program that isn't currently running may still be available on demand. Check the listener and its configuration before concluding that the service is disabled.
What Is a Daemon? The Programs Working Behind Your Apps

Network Services: One Computer Asks, Another Does the Job

Unix: A Family History, a Standard and a Set of Permissions

QUOTE:
"Amateurs hack systems, professionals hack people."
