Chapter 7

FTP Server

The ftpd structure contains a complete anonymous ftp server.

(ftpd options)     --->     no return value         (procedure) 
(ftp-inetd options)     --->     no return value         (procedure) 
Ftpd starts the server, using anonymous-home as the root directory of the server.

ftpd-inetd is the version to be used from inetd. Ftpd-inetd handles the connection through the current standard output and input ports.

The options argument can be constructed through a number of procedures with names of the form with-.... Each of these procedures either creates a fresh options value or adds a configuration parameter to an old options argument. The configuration parameter value is always the first argument, the (old) options value the optional second one. Here they are:

(with-port port [options])     --->     options         (procedure) 
This specifies the port on which the server listens. Defaults to 21.

(with-anonymous-home string [options])     --->     options         (procedure) 
This specifies the home directory for anonymous logins. Defaults to "~ftp".

(with-banner list [options])     --->     options         (procedure) 
This specifies an alternative greeting banner for those members of the Untergrund who prefer to remain covert. The banner is represented as a list of strings, one for each line of output.

(with-log-port output-port [options])     --->     options         (procedure) 
If this is non-#f, exftpd outputs a log entry for each file sent or retrieved on output-port. Defaults to #f.

(with-dns-lookup? boolean [options])     --->     options         (procedure) 
If dns-lookup? is #t, the log file will contain the host names instead of their IP addresses. If dns-lookup? is #f, the log will only contain IP addresses. Defaults to #f.
The make-ftpd-options eases the construction of the options argument:

(make-ftpd-options transformer value ...)     --->     options         (procedure) 
This constructs an options value from an argument list of parameter transformers and parameter values. The arguments come in pairs, each an option transformer from the list above, and a value for that parameter. Make-ftpd-options returns the resulting options value.

The log format of ftpd is the same as the one of wuftpd. The entries look like this:

Fri Apr 19 17:08:14 2002 4 134.2.2.171 56881 /files.lst b _ i a nop@ssword ftp 0 *

These are the fields:

  1. Current date and time. This field contains spaces and is 24 characters long.

  2. Transfer time in seconds.

  3. Remote host IP (wu-ftpd puts the name here).

  4. File size in bytes

  5. Name of file (spaces are converted to underscores)

  6. Transfer type: ascii or binary (image type).

  7. Special action flags. As ftpd does not support any special action, it always has _ here.

  8. File was sent to user (outgoing) or received from user (incoming)

  9. Anonymous access

  10. Anonymous ftp password.

  11. Service name -- always ftp.

  12. Authentication mode (always ``none'' = `0').

  13. Authenticated user ID (always ``not available'' = `*')

The server also writes log information to the syslog facility. The following syslog levels occur in the output:

notice

info
Messages concerning all other commands, including the RETR command.
debug
all other messages, including debug messages