email – Understanding /etc/aliases and Its Functions

email

These are the contents of '/etc/aliases' file on my Debian (Wheezy) server, as it is:

# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: t

1. I noticed that, by default, my server sends email from what looks like root@hostname.domain.com. So, which one of the rules above governs this? postmaster: root;?

2. So, the rules in '/etc/aliases' are used to assign users to specific departments? That is, for example, all emails to be sent/received for 'abuse' will be delivered from/to root@hostname.domain.com (which'd be the default email for root, unless there's an alias). Correct?

3. Can someone please explain what each of these really meant for — mailer-daemon, postmaster, nobody, hostmaster, usenet, news, webmaster, www, ftp, abuse, noc, security, root?

I mean, a description like "mailer-daemon for sending email delivery errors, but not really meant for receiving emails. security for where people should contact your about security issues", or something like that.

Best Answer

The /etc/aliases file is part of sendmail. It specifies which account mail sent to an alias should really be delivered to. For example, mail to the ftp account would be sent to root's mailbox in the configuration you show.

Multiple recipients can be specified as comma-separated lists, too.

Redirecting mail to users isn't all that can be done. Mail can be piped to programs, too, or simply directed into a file of your choice. The following would "bit-bucket" all mail from the user "somebody":

somebody : /dev/null

Modifications to the /etc/aliases file are not complete until the newaliases command is run to build /etc/aliases.db. It is in this later form that sendmail actually uses.

Related Question