Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>:   <virtual_user@mydomain.org>

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/main.cf:

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 = <mydomain.org>
myhostname = <myhost.mydomain.org>
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 = <mydomain.org mydomain2.org mydomain3.org ...>
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 root@mydomain.org, which it then wants to deliver via virtual but of course root@mydomain.org 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 = <mydomain.org> to above config output, because that wasn't obvious.

share|improve this question
Have you tried root <virtual_user@mydomain.org> instead? –  NickW Jun 3 '13 at 16:31
@NickW No it somehow gets expanded to root@mydomain.org before the alias lookup. So that should not change anything. –  BubuIIC Jun 3 '13 at 16:44
Ah, I was assuming you had mydomain.org 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
add comment

2 Answers

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 root@mydomain.org expsoed to the outside world. Only local delivery should be allowed to root. –  BubuIIC Jun 3 '13 at 16:37
Take a look at postfix.org/RESTRICTION_CLASS_README.html -- 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
add comment

Try adding to your mydestination definition

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

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
add comment

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.