Apache (httpd), SSH (sshd) and ProFTP (in.ftpd) are usually set up in Linux distributions to be launched by the init scripts. This is the ideal configuration for heavily-used servers, but for a system in which they’re only occasionally used, it makes more sense to launch them with xinetd (used to be inetd).
First, make sure they aren’t being launched by init.
The directory /etc/xinetd.d should contain only files
Use some existing config file as a template. Each file should contain the lines
disable = no wait = no flags = REUSE socket_type = stream protocol = tcp user = root
Then, port
has to be set appropriately,
server
is the full path to the binary of the server,
server_args
is sometimes important—see below.
Note that this doesn’t work for Apache2. There seems to be no way for that version.
On my system, the Apache server is /usr/sbin/httpd. It sits on port 80.
In /etc/httpd/conf/httpd.conf, make sure the ServerType
line reads
ServerType inetd
.
To enable certain modules, the -D
flag has to be set. For example,
server_args = -D HAVE_PERL -D HAVE_PHP4 -D HAVE_SSL -D SSL
The docs seem to discourage launching it with xinetd, but I think that’s only when you expect heavy use. My primary use is to experiment with web pages; any other use I expect to be very light.
On my system, the SSH server is /usr/sbin/sshd. It sits on port 22.
To make sshd run in inetd mode, put the line
server_args = -i
in the corresponding xinetd config file.
But now I see the man page says this is discouraged, on account that it might take a long time to generate keys. On the other hand, I don’t expect to often log in from different computers.
On my system, the ProFTP server is /usr/sbin/in.ftpd. It sits on port 21.
In /etc/proftpd.conf, make sure the ServerType
line is
ServerType inetd