Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a mail server set up which is responsible for several virtual users and domains. These mails are delivered fine to the respective mailbox.

But I can't get local delivery for system accounts (root, http, ...) to work. This is my alias file:

root:           <local_user>
<local_user>:   <>

MAILER-DAEMON:  postmaster
postmaster:     root

bin:            root
daemon:         root
named:          root
nobody:         root
uucp:           root
www:            root
ftp-bugs:       root
postfix:        root
http:           root

This is the relevant part of /etc/postfix/

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
append_dot_mydomain = no
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = localhost.$mydomain, localhost, localhost.localdomain
mydomain = <>
myhostname = <>
mynetworks_style = host
myorigin = $mydomain
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = < ...>
virtual_mailbox_maps = hash:/etc/postfix/vmailbox

Values in <...> are obviously placeholders.

When I locally send a mail to root. Postfix completes the address to, which it then wants to deliver via virtual but of course is not a valid virtual address (and it should not be).

It would work if the address is completed to root@localhost for local delivery. But when sending emails.

How would I accomplish that? Or what else should I do to get local delivery to work? Thanks for your help.

/e: added mydomain = <> to above config output, because that wasn't obvious.

share|improve this question
Have you tried root <> instead? – NickW Jun 3 '13 at 16:31
@NickW No it somehow gets expanded to before the alias lookup. So that should not change anything. – BubuIIC Jun 3 '13 at 16:44
Ah, I was assuming you had as $mydomain – NickW Jun 3 '13 at 16:48
@NickW I have. But still happens as described above. /e: maybe because it's also a virtual domain? – BubuIIC Jun 3 '13 at 16:53

Try adding to your mydestination definition

mydestination = localhost.$mydomain, localhost, localhost.localdomain, <>

Or, change the email to go to root@localhost.

Me, I stopped using local account for any email and have all system accounts configured as virtual domains. Then I can run email for the system using the same set of tools as I do for the virtual domains (and the mail is all stored in the same place).

I'm not sure that your current config will block email to root that comes from outside the box. You might want to test that.

share|improve this answer

By default postfix will append $myorigin whenever the recipient part doesn't have valid domain. This behavior was controlled by append_dot_mydomain parameter (default: yes). You can read some rewriting schema that postfix do in this page.

Because myorigin was set as $mydomain, then you get behavior you described above

When I locally send a mail to root. Postfix completes the address to, which it then wants to deliver via virtual but of course is not a valid virtual address (and it should not be).


Change the myorigin to localhost.$mydomain. It will set the completion address to localhost.$mydomain. Because localhost.$mydomain was defined in mydestination then postfix will use /etc/aliases to perform aliasing.

share|improve this answer

One solution is to just add the virtual domain (typically the fully qualified hostname) and virtual mailbox definitions for all of the local accounts that you want to allow to send mail.

share|improve this answer
I have considered that, but I don't want expsoed to the outside world. Only local delivery should be allowed to root. – BubuIIC Jun 3 '13 at 16:37
Take a look at -- you can setup per-address restriction lists. In our setup, we use root@, postgres@, etc. as convenient ways of gathering spam samples to feed to spamassassin's sa-learn. – tgharold Jun 3 '13 at 19:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.