Next Previous Contents

## 6. FTP Servers

## 6.1 How an FTP Server works

A traditional FTP server is executed from inetd (the internet superserver daemon). The standard FTP port is port 21. When a user tries to log in, the FTP server uses a standard system call to check the user name and password against the entries in the system password file, or the NIS tables if you are using NIS. If the login is correct, the user is given access to the system.

Anonymous FTP works differently. The user logs in with either the anonymous or the ftp username (this can be defined in the config file). He is then given access to a directory tree that has been chroot()'ed. This ensures that the user can not gain access to directory trees he is not authorized for. The chrooted directory tree usually contains a mock filesystem, with bin/, etc/, and lib/ directories. The files for download are usually put in the pub/ directory.

The reason for a mock filesystem in an anonymous FTP tree is that the FTP daemon runs external commands for ls requests. You can also place additional programs in the bin directory, and a user can run them with the SITE command in his ftp client. For example, Red Hat's FTP includes the RPM command (for users to query RPM packages on the site).

Some FTP servers work differently. For example, some will allow user accounts to be set up independant of the system-wide password file (FTP-only accounts). Some servers (ProFTPD and NcFTPd for instance) have built-in ls commands and do not need a special directory tree within the chroot structure. Other ftp servers stray altogether from the standard ftp concept. FTP4ALL, for example, does not use system passwords at all. It uses it's own user and group file, and has features such as upload/download ratio and customizable server messages.

## 6.2 Help with FTP Servers

### WU-FTPD

WU-FTPD is the ftp daemon included with many Linux distributions, including Red Hat and Caldera. You can learn more about WU-FTPD at http://www.wu-ftpd.org.

The WU-FTPD FAQ can be found on the web at http://www.cetis.hvu.nl/~koos/wu-ftpd-faq.html.

### ProFTPD

ProFTPD is a powerful FTP server that includes Apache-style configuration, extensive support for virtual hosts, and internal ls.

A complete command reference and downloads can be found at http://www.proftpd.org

Next Previous Contents