System Administration Guide: Network Services
Previous Next

Virtual Hosting

Virtual hosting allows the FTP server to support multiple domains on the same machine. Each virtual host requires a separate logical interface and IP address.

The FTP server supports two types of virtual hosting: limited and complete. With limited virtual hosting, the same configuration files are used for all virtual hosts. With complete virtual hosting, separate configuration files can be used for each virtual host.


Note - By default, real and guest users are not allowed to log in to virtual hosts. You can set the following ftpaccess directives to override the default.

To allow access to specific users:
virtual address allow username
To deny access to anonymous users:
virtual address private username

See ftpaccess(4) for further information.

How to Enable Limited Virtual Hosting

Limited virtual hosting provides partial support for virtual FTP servers. You can enable support for limited virtual hosting by specifying the virtual root directory. If required, you can also set the following parameters for the virtual host in the ftpaccess file:

  • banner

  • logfile

  • email

  • hostname

All directives in the ftpaccess file are shared globally across all virtual servers.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add the following entries to the ftpaccess file.
    virtual address root|banner|logfile path
    virtual address hostname|email string
    virtual

    Keyword that is used to enable virtual server capabilities

    address

    IP address of the virtual server

    root

    The root directory of the virtual server

    banner

    Banner file that is displayed when a connection is made to the virtual server

    logfile

    Record of file transfers that are made to and from the virtual server

    path

    Variable that is used to specify the location of directories and files on the virtual server

    email

    Email address that is used in message files and in the HELP command

    hostname

    Name of the host that is shown in the greeting message or status command

    string

    Variable that is used to specify email or hostname parameters


    Note - While it is possible to use hostname as the address of the virtual server, you are strongly encouraged to use the IPv4 address instead. DNS must be available when the FTP connection is received in order for hostname to be matched. For an IPv6 host, use the host name rather than the IPv6 address.


Example 28-15 Enabling Limited Virtual Hosting in the ftpaccess File
virtual 10.1.2.3 root    /var/ftp/virtual/ftp-serv
virtual 10.1.2.3 banner  /var/ftp/virtual/ftp-serv/banner.msg
virtual 10.1.2.3 logfile /var/log/ftp/virtual/ftp-serv/xferlog

The preceding example sets the location of the root directory, banner, and logfile on a virtual FTP server.

Example 28-16 Enabling Limited Virtual Hosting on the Command Line

The ftpaddhost(1M) script with the -l option is provided to configure limited virtual hosts.

In the following example, ftpaddhost is run with -l -b -x options to configure limited virtual hosting with a test banner and the logfile /var/ftp/virtual/10.1.2.3/xferlog under a virtual root /var/ftp/virtual/10.1.2.3.

# ftpaddhost -l -b -x /var/ftp/virtual/10.1.2.3/xferlog \
/var/ftp/virtual/10.1.2.3

How to Enable Complete Virtual Hosting

Complete virtual hosting allows separate configuration files for each virtual domain. To enable complete support for virtual hosting on the FTP server, you can create or modify the following FTP configuration files for specific domains:

  • ftpaccess

  • ftpusers

  • ftpgroups

  • ftphosts

  • ftpconversions

For further information, see ftpaccess(4), ftpusers(4), ftpgroups(4), ftphosts(4), and ftpconversions(4).


Note - If separate versions of the configuration files are unavailable, master versions of the files in the /etc/ftpd directory are used.


  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add the following entry to the /etc/ftpd/ftpservers file.
    address /config-file-dir
    address

    IP address of the virtual server

    config-file-dir

    Directory that contains the configuration files that are customized for the virtual host


    Note - While it is possible to use hostname as the address of the virtual server, you are strongly encouraged to use the IPv4 address instead. DNS must be available when the FTP connection is received in order for hostname to be matched. For an IPv6 host, use the host name rather than the IPv6 address.


  3. To create a customized version of an FTP server configuration file for the virtual host, copy the master version of the file from /etc/ftpd to the /config-file-dir directory.

    For further information, see ftpservers(4).

Example 28-17 Enabling Complete Virtual Hosting in the ftpservers file
#
# FTP Server virtual hosting configuration file
#

10.1.2.3 /net/inet/virtual/somedomain/
10.1.2.4 /net/inet/virtual/anotherdomain/

The preceding example specifies the IP addresses for two different domains on the virtual server.

Example 28-18 Enabling Complete Virtual Hosting from the Command Line

The ftpaddhost(1M) script with the -c option is provided to configure complete virtual hosts.

In the following example, ftpaddhost is run with -c -b -x options to configure complete virtual hosting with a test banner and the logfile /var/ftp/virtual/10.1.2.3/xferlog under a virtual root /var/ftp/virtual/10.1.2.3.

# ftpaddhost -c -b -x /var/ftp/virtual/10.1.2.3/xferlog \
/var/ftp/virtual/10.1.2.3
Previous Next