#### 3.2.17 The `virtdomain` Statement ¶

#### Syntax ¶

    virtdomain {
      # Name of the virtdomain password directory.
      passwd-dir dir;
    }

#### Description ¶

Virtual mail domains make it possible to handle several mail domains each having a separate set of users, on a single server. The domains are completely independent of each other, i.e. the same user name can be present in several domains and represent different users.

When authenticating to a server with virtual domain support enabled, users must supply their user names with domain parts. The server strips off the domain part and uses it as a name of UNIX-format password database file, located in the domain password directory. The latter is set using `passwd-dir` statement.

Configuration: passwd-dir dir ¶

  Set virtual domain password directory.

For example, when authenticating user ‘`smith@example.com`’, the server will use password file named `dir/example.com`. This file must be in UNIX passwd format (see password file in passwd(5) man page), with encrypted passwords stored in it (as of GNU Mailutils version 3.20, there is no support for shadow files in virtual password directories, although this is planned for future versions). Here is an example record from this file:

    smith:Wbld/G2Q2Le2w:1000:1000:Email Account:/var/mail/domain/smith:/dev/null

Notice, that it must contain user names without domain parts.

The `pw_dir` field (the 6th field) is used to determine the location of the maildrop for this user. It is defined as `pw_dir/INBOX`. In our example, the maildrop for user ‘`smith`’ will be located in file `/var/mail/domain/smith`.

If user did not supply his domain name, or if no matching record was found in the password file, or if the file matching the domain name does not exist, then GNU Mailutils falls back to alternative method. First, it tries to determine the IP address of the remote party. Then the domain name corresponding to that address is looked up in the DNS system. Finally, this domain name is used as a name of the password file.