D. J. Bernstein
Internet publication

The ftpd program

ftpd handles an FTP connection.


     ftpd root

ftpd prints requested public files from the root directory hierarchy. Normally root is /public/file.

ftpd accepts PWD, CWD, CDUP, TYPE, PORT, PASV, SPSV, REST, RETR, LIST, NLST, and QUIT requests on standard input in FTP format. It prints responses on standard output, and local log information on standard error.

ftpd recognizes USER, PASS, and ACCT, but it does not check usernames or passwords. It has minimal support for STRU, MODE, SYST, HELP, and NOOP.

ftpd exits silently if it runs out of memory, encounters an I/O error, or does not receive an input packet within 60 seconds.

Normally ftpd is run under tcpserver to handle FTP connections from hosts around the Internet. Note that ftpd does not print the standard FTP greeting message; the greeting message is handled by tcpserver.

File handling

A request for a file or directory named f refers to ./0/f inside the root directory hierarchy.

ftpd has built-in support for NLST and LIST; it does not run an external root/bin/ls. It provides EPLF LIST responses, including EPLF options "i", "s", and "m".


ftpd chroots to root when it starts. It then sets its group id and user id to the numbers given in environment variables $GID and $UID, as set by envuidgid.

ftpd does not allow dots immediately after slashes in file names. It converts any such dots to colons before attempting to open the file.

ftpd will refuse to read a file if the file

In directory listings, ftpd will skip a file if the name begins with a dot. It will also skip names that contain tildes, spaces, or control characters; note, however, that these files can still be accessed by someone who knows or guesses the name.

ftpd uses local ports above 1024 for PORT connections, rather than the standard port 20. It rejects remote ports below 1024, and it rejects third-party PORT. It also rejects third-party PASV.

Unsupported features

ftpd does not support file modification requests such as STOR.