The ServerType configuration directive for ProFTPD can cause
confusion for those just starting with this server. What is the purpose
for this directive? What are these "inetd" and "standalone"
types, and why does one need to choose one or the other?
The purpose of this directive is to choose between the two operating modes for
almost all Unix network servers: does the server listen on its port for
client requests itself, or does the server let some other process do the
listening, and call the server when needed? Traditionally, that
"other process" has been inetd, a
"super server" that listens on all interfaces, all ports on a
Unix machine, and calls the appropriate server based on the port contacted.
A more modern replacement for inetd is found in the
xinetd server; this server functions much the same way. The
other mode of operation is to have the server listen on the port(s) itself,
and handle client requests accordingly. The latter mode is the
standalone ServerType, the former is the inetd
mode (which covers both the inetd and xinetd
processes).
This directive is mandatory, and must be set to one mode or the other. The
two modes are incompatible (two processes cannot be bound to the same
interface/port combination simultaneously), and thus the proftpd
must be told in which mode it is to operate.
Inetd Mode
In inetd mode, the proftpd server expects to be started
by the inetd (or xinetd) servers. It is these
servers, inetd/xinetd, that listen on the FTP port (usually 21)
for connection requests, then start proftpd and pass the
connection off. This mode is usually best suited for low traffic sites,
for sites that do not handle many FTP sessions.
Example /etc/inetd.conf entry:
ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/proftpdThe
inetd.conf man pages discuss these fields in greater detail.
An example xinetd configuration is:
service ftp
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/proftpd
server_args = -c /etc/proftpd.conf
}
The xinetd configuration is usually found in /etc/xinetd.conf
or in the /etc/xinetd.d/ directory.
Note: Solaris users may find that their /etc/inetd.conf
file ships with an ftp entry that looks similar to the above,
except that it has "tcp6" rather than "tcp". For
proftpd to function properly in such cases, that "tcp6"
will need to be changed to "tcp". Solaris uses the tcp6
keyword to have its inetd pass IPv6 sockets to the called program;
proftpd must have been configured with the
--enable-ipv6 option to handle such sockets.
Inetd Mode and Non-standard Ports
A note about using non-standard ports in your configuration via the
Port configuration directive: making these work while in
inetd mode and using inetd (&qule different IP addresses (or DNS names), the
<VirtualHost> supports this:
<VirtualHost 1.2.3.4 5.6.7.8>
...
</VirtualHost>
If, however, you want to specific the address to which the configuration
of the "server config" context, use DefaultAddress
(mentioned above).
There is one last configuration directive about which an administrator should
know: SocketBindTight. By default, the
proftpd daemon will listen on all addresses, port 21, for the
connection requests of remote clients. Sometimes, the administrator may
wish to have the proftpd daemon listen only on the IP
addresses for which it has been configured, and not every address.
To accomplish this, simply use the SocketBindTight configuration directive:
SocketBindTight onThis configures the daemon to "bind tightly" only to those IP addresses to which it has been configured to listen, rather than every address. By default, the
proftpd daemon will listen to every address on
the host machine.
Question: Why do I see the following when I start proftpd?
- warning: "Virtual Server" address/port (1.2.3.4:21) already in use by "Main Server"Answer: This happens when a
<VirtualHost> section is "hidden" behind the default server in the "server config"
section (i.e. the context that is outside of all <VirtualHost> and <Global> sections). It is "hidden" because
both the <VirtualHost> section and the "server config"
section are using the same IP address and port.
It is quite common to configure <VirtualHost> sections
using DNS names, rather than IP addresses. And the "server config" section
in the proftpd.conf file, by default, uses the IP address of
the machine's hostname. This makes it quite easy to inadvertently have
multiple sections trying to use the same IP address and port.
The quick-and-easy fix is to place the following your "server config" section
in your proftpd.conf:
Port 0as mentioned above. You can also use the
DefaultAddress
directive in the "server config" section to explicitly tell the "server config"
section to use a different IP address/DNS name.
Question: How can I have my "server config" section
(or a <VirtualHost> section) listen for multiple IP
addresses/DNS names?
Answer: In version 1.3.0rc1 and later, the
<VirtualHost> configuration was enhanced so that it could
handle multiple IP addresses/DNS names, e.g.:
<VirtualHost 1.2.3.4 ftp.example.com>
...
</VirtualHost>
And for the "server config" context, you would use the
DefaultAddress directive, which can also handle multiple IP
addresses/DNS names:
DefaultAddress 1.2.3.4 ftp.example.com