ALIASES(5) Standards, Environments, and Macros ALIASES(5)


aliases, addresses, forward - addresses and aliases for sendmail








These files contain mail addresses or aliases, recognized by sendmail(8)
for the local host:


Mail addresses (usernames) of local users.


Aliases for the local host, in ASCII format. Root can edit this file
to add, update, or delete local mail aliases.

/etc/mail/aliases.{dir , pag}

The aliasing information from /etc/mail/aliases, in binary ndbm(3C)
format for use by sendmail(8). The program newaliases(8) maintains
these files.


The aliasing information from /etc/mail/aliases, in binary, Berkeley
DataBase format for use by sendmail(8). The program maintains these

Depending on the configuration of the AliasFile option in
/etc/mail/, either the single file aliases.db or the pair
of files aliases.{dir, pag} is generated by newaliases(8). As shipped
with Solaris, sendmail(8) supports both formats. If neither is
specified, the Berkeley DataBase format which generates the single
.db file is used.


Addresses to which a user's mail is forwarded (see Automatic

In addition, the NIS name services aliases map mail.aliases contains
addresses and aliases available for use across the network.


As distributed, sendmail(8) supports the following types of addresses:

Local Usernames


Each local username is listed in the local host's /etc/passwd file.

Local Filenames


Messages addressed to the absolute pathname of a file are appended to
that file.



If the first character of the address is a vertical bar (|), sendmail(8)
pipes the message to the standard input of the command the bar precedes.

Internet-standard Addresses

If domain does not contain any `.' (dots), then it is interpreted as the
name of a host in the current domain. Otherwise, the message is passed to
a mailhost that determines how to get to the specified domain. Domains
are divided into subdomains separated by dots, with the top-level domain
on the right.

For example, the full address of John Smith could be:


if he uses the machine named jsmachine at Podunk University.

uucp Addresses
... [host!] host!username

These are sometimes mistakenly referred to as ``Usenet'' addresses.
uucp(1C) provides links to numerous sites throughout the world for the
remote copying of files.

Other site-specific forms of addressing can be added by customizing the configuration file. See sendmail(8) for details. Standard
addresses are recommended.


Local Aliases

/etc/mail/aliases is formatted as a series of lines of the form

aliasname:address[, address]

aliasname is the name of the alias or alias group, and address is the
address of a recipient in the group. Aliases can be nested. That is, an
address can be the name of another alias group. Because of the way
sendmail(8) performs mapping from upper-case to lower-case, an address
that is the name of another alias group must not contain any upper-case

Lines beginning with white space are treated as continuation lines for
the preceding alias. Lines beginning with # are comments.

Special Aliases

An alias of the form:

owner-aliasname : address

sendmail directs error-messages resulting from mail to aliasname to
address, instead of back to the person who sent the message. sendmail
rewrites the SMTP envelope sender to match this, so owner-aliasname
should always point to alias-request, and alias-request should point to
the owner's actual address:

owner-aliasname: aliasname-request
aliasname-request address

An alias of the form:

aliasname: :include:pathname

with colons as shown, adds the recipients listed in the file pathname to
the aliasname alias. This allows a private list to be maintained
separately from the aliases file.

NIS Domain Aliases

The aliases file on the master NIS server is used for the mail.aliases
NIS map, which can be made available to every NIS client. Thus, the
/etc/mail/aliases* files on the various hosts in a network will one day
be obsolete. Domain-wide aliases should ultimately be resolved into
usernames on specific hosts. For example, if the following were in the
domain-wide alias file:


then any NIS client could just mail to jsmith and not have to remember
the machine and username for John Smith.

If a NIS alias does not resolve to an address with a specific host, then
the name of the NIS domain is used. There should be an alias of the
domain name for a host in this case.

For example, the alias:


sends mail on a NIS client to root@podunk-u if the name of the NIS domain
is podunk-u.

Automatic Forwarding

When an alias (or address) is resolved to the name of a user on the local
host, sendmail(8) checks for a ~/.forward file, owned by the intended
recipient, in that user's home directory, and with universal read access.
This file can contain one or more addresses or aliases as described
above, each of which is sent a copy of the user's mail.

Care must be taken to avoid creating addressing loops in the ~/.forward
file. When forwarding mail between machines, be sure that the destination
machine does not return the mail to the sender through the operation of
any NIS aliases. Otherwise, copies of the message may "bounce." Usually,
the solution is to change the NIS alias to direct mail to the proper

A backslash before a username inhibits further aliasing. For instance, to
invoke the vacation program, user js creates a ~/.forward file that
contains the line:

\js, "|/usr/ucb/vacation js"

so that one copy of the message is sent to the user, and another is piped
into the vacation program.

The ~/.forward file can be used to specify special "per user" extensions
by creating a .forward+extension file in the home directory. For example,
with an address like jsmith+jerry@jsmachine, the sendmail(8) utility
recognizes everything before the "+" as the actual username (jsmith) and
everything after it, up to the "@" symbol, as the extension (jerry) which
is passed to the mail delivery agent for local use.

The default value of the ForwardPath processing option in sendmail(8) is:

O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z \

where $z is the macro for the user's home directory, $w is the macro for
the local machine name and $h is the extension. For example, for mail
using the address, jsmith+jerry@jsmachine, the sendmail(8) utility checks
each of the four following file names, in the order given, to see if it
exists and if it has "safe" permissions, that is, that neither the file
nor any of its parent directories are group- or world-writable:


The first file that meets the conditions is used to forward the mail,
that is, all the entries in that file receive a copy of the mail. The
search is then stopped.


Password file

Name service switch configuration file

Mail aliases file (ascii)

Database of mail aliases (binary)

Database of mail aliases (binary)

Database of mail aliases (binary)

sendmail configuration file

Forwarding information file


passwd(1), vacation(1), uucp(1C), getusershell(3C), ndbm(3C), passwd(5),
shells(5), attributes(7), newaliases(8), sendmail(8)


Because of restrictions in ndbm(3C), a single alias cannot contain more
than about 1000 characters (if this format is used). The Berkeley
DataBase format does not have any such restriction. Nested aliases can be
used to circumvent this limit.

For aliases which result in piping to a program or concatenating a file,
the shell of the controlling user must be allowed. Which shells are and
are not allowed are determined by getusershell(3C).

February 25, 2017 ALIASES(5)