Using Mail Aliases (Part 3):
The Red Hat /etc/aliases
file opens with several comment lines. Ignore the information about which
mail programs display aliases in the headers of mail messages; it is not really significant. The
comment that is significant is the one that tells you to run newaliases every time you update this file.
sendmail does not read the /etc/aliases
file directly. Instead, it reads a database file produced from
this file by the newaliases command.
The first 40 or so lines define aliases for special names. All of them, except the webmaster alias that
we added, come preconfigured in the Red Hat aliases file. The first two are aliases that people
expect to find on any system running sendmail. Most of the others are aliases assigned to the
daemon usernames that are found in the /etc/passwd
file. No one can actually log in using the
daemon usernames, so any mail that might be directed to these pseudo accounts is forwarded to a
real user account. In the previous listing, all of this mail is forwarded to the root user account—even mail
addressed to newsadm and ftpadm, which at first glance appears to be routed to accounts other
than root. For example, newsadm appears to be routed to the user account news, but closer
examination reveals that news is itself an alias that is routed to the root account. Aliases can point
to other aliases, but eventually they must resolve to a real e-mail account for mail to be successfully
delivered.
Of course, you don't really want people logging in to the root account just to read mail, so the aliases file also has an alias for root. In the example, we edited the root entry to forward all mail addressed to root to staff, which is another alias. Notice how often aliases point to other aliases. Doing this is very useful because it allows you to update one alias instead of many when the real user account that the mail is delivered to changes.