58

This is the contents of the file /etc/aliases 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 emails from what looks like [email protected]. 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? For example, all emails to be sent/received for abuse will be delivered from/to [email protected] (which would be the default email for root, unless there's an alias). Correct?

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

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

1

2 Answers 2

75

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 for 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.

8
  • So, is there a security daemon too? ('security' is listed in /etc/aliases.) When exactly is it triggered?
    – its_me
    Commented Feb 16, 2013 at 20:16
  • 2
    More generally it specifies to whom mail should be delivered when addressed to the alias on this host. Mail to ftp would be delivered to the root mailbox. Although it is often used to redirect locally generated/delivered mail to somewhere useful it works for email from anywhere and from anyone, if accepted by sendmail and the config says to use the alias file.
    – Matt
    Commented Feb 16, 2013 at 20:17
  • You should use ` character instead of ' at the last paragraph. Commented Feb 16, 2013 at 20:17
  • 14
    Nearly every modern *nix MTA is sendmail compatible. The existence of /etc/aliases does not mean it uses sendmail. Postfix and exim4 both use /etc/aliases as well.
    – jordanm
    Commented Feb 17, 2013 at 4:15
  • 1
    If you're being a "good sysadmin" you would avoid using the root account where possible, so forwarding mail to a normal user means you need root less. In any case, if I need system mail it gets forwarded out to normal pop/imap accounts that people check.
    – Matt
    Commented Feb 18, 2013 at 23:03
5

mailer-daemon, hostmaster and postmaster are special mail addresses required by various RFC's, with the apparent exception of mailer-daemon which we can regard as being "entrenched by convention or tradition".

You need mailer-daemon in order to handle issues related to mail itself, such as SMTP bounce messages. If your mail server receives an undeliverable message, it generates an SMTP non-delivery notice, whose From: address is mailer-daemon. The alias is there in case someone replies to a bounce message; it goes to the postmaster, who is a human being, which "mailer daemon" isn't. I can't find any RFC which describes mailer-daemon let alone requires it. You could probably rename this alias to something else like mailer-server, but then you would have to reprogram your mail server to identify itself as mailer-server when sending bounces. I can't think of a reason why bounces couldn't just be from postmaster.

RFC 2142, section 5, gives a summary of some special aliases, and points to other RFC's where they are introduced. Here we learn that postmaster is specified as far back as RFC 822 (it is in its section 6.3). It is a requirement for mail sites to have this alias. hostmaster is mentioned in RFC's 1033, 1034 and 1035. The other aliases you're wondering about are also given in 2142.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .