The /etc/mail/aliases and aliases.db files

Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
Prev | Chapter 22. Software -Server/Mail Network | Next

# 22.7. The `/etc/mail/aliases` and `aliases.db` files

Aliasing is the process of converting one local recipient name on the system into another -aliasing occurs only on local names. Example uses are to convert a generic name -such as root, into a real username on the system, or to convert one name into a list of many names -for mailing lists. For every envelope that lists a local user as a recipient, Sendmail looks up that recipient's name in the `aliases` file. Because Sendmail may have to search through thousands of names in the `aliases` file, a copy of the file is stored in a separate `db` database format file to significantly improve lookup speed. If you configure your Sendmail to use a Central Server `Mail Hub` to handles all mail, you don't need to install the `aliases` and `aliases.db` files on the neighbor server or client machines.

1. Create the `aliases` file touch `/etc/mail/aliases` and add the following lines by default:

                #
                #       @(#)aliases     8.2 (Berkeley) 3/5/94
                #
                #  Aliases in this file will NOT be expanded in the header from
                #  Mail, but WILL be visible over networks or from /bin/mail.
                #
                #       >>>>>>>>>>      	The program "newaliases" must be run after
                #       >> NOTE >>      	this file is updated for any changes to
                #       >>>>>>>>>>      	show through to sendmail.
                #

                # Basic system aliases -- these MUST be present.
                MAILER-DAEMON:  	postmaster
                postmaster:     		root

                # General redirections for pseudo accounts.
                bin:            	root
                daemon:         	root
                nobody:         	root

                # Person who should get root's mail
                #root:          	admin

   > : Your aliases file will be probably far more complex, but even so, note how the example shows the minimum form of aliases.

2. Since `/etc/mail/aliases` is a database, after creating the text file as described above, you must use the makemap program to create the database map. To create the `aliases database map`, use the following command:

                [root@deep] /# makemap hash /etc/mail/aliases.db < /etc/mail/aliases

## 22.7.1. The `/etc/mail/` Directory

The

- `/etc/mail/virtusertable,`

- `domaintable`

- `mailertable`

and

- `virtusertable.db,`

- `domaintable.db,`

- `mailertable.db`

All of these files relate to particular features of Sendmail that can be tuned by the system administrator. Once again, these features are usually required only in the Central Mail Hub server. The following is the explanation of each one.

The `virtusertable` & `virtusertable.db` files

  A virtusertable is a database that maps virtual domains into news addresses. With this feature, mail for virtual domain on your network can be delivered to local, remote, or a single user address.

The `domaintable` & `domaintable.db` files

  A domaintable is a database that maps old domain to a new one. With this feature, multiple domain names on your network can be rewritten from the old domain to the new.

The `mailertable` & `mailertable.db` files

  A mailertable is a database that maps `host.domain` names to special delivery agent and new domain name pairs. With this feature mail on your network can be delivered through the use of a particular delivery agent to a new local or remote domain name.

To create the `virtusertable, domaintable, mailertable`, and their corresponding `.db` files into `/etc/mail` directory, use the following commands:

             [root@deep] /# for map in virtusertable domaintable mailertable

             > do
             > touch /etc/mail/${map}
             > chmod 0644 /etc/mail/${map}
             > makemap hash /etc/mail/${map}.db < /etc/mail/${map}
             > chmod 0644 /etc/mail/${map}.db
             > done

Prev | Home | Next
The `/etc/mail/access` and `access.db` files | Up | The `/etc/mail/local-host-names` file