Virtual Hosting


If you have multiple IP addresses bound to your machine, you can map different FTP server behaviors to each one. This virtual hosting mechanism is controlled with the /etc/ftphosts file, which does not exist in the default FreeBSD system (you need to create it).

Each virtual host is defined on its own line, with fields specifying alternate config files for each host separated by whitespace. Table 27.2 describes the various fields, their meanings, and the default values (the ones that the server uses without an /etc/ftphosts file present).

Table 27.2. Virtual Hosting Table Fields in /etc/ftphosts

Field

Description

Default

Hostname

The hostname or IP address of the virtual host. Note that FTP has no equivalent of the Host: header of HTTP/1.1, so FTP virtual hosts are defined purely on the IP address of your machine where the client is connected, so each virtual host must have its own unique IP address or alias. If you use a hostname in this field, ftpd uses the IP address to which it resolves. Bear this in mind when adding virtual hosts.

N/A

User

The user whose home directory is used for anonymous FTP access in this virtual host. Anonymous users are jailed (via chroot) into this directory, so equivalents of /var/ftp/etc and /var/ftp/bin should be present.

ftp

Statfile

The log file that tracks all FTP transfers for the virtual host.

/var/log/ftpd

Welcome

The welcome message displayed upon initial connection to the FTP server.

/etc/ftpwelcome

MOTD

The second welcome message, presented after a successful user login.

/etc/ftpmotd


A few sample virtual hosts in /etc/ftphosts follow. If a field is left blank or has a hyphen (-), the default value is used:

64.41.131.106    frank   /var/log/ftpd-frank   /home/frank/hi  /home/frank/hi2 ftp2.me.com      ftp2    -                     /etc/ftpd2welcome    - 64.41.131.107    ftp3    /var/log/ftpd-3       -                   -





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net