Tag Archives: alias_database

Postfix relayhost and aliases

I spent a few hours today figuring out why the /etc/aliases file was ignored by postfix. Mail to root was being delivered to root@exampl.tld instead of being rewritten by the /etc/aliases file. The solution is to use virtual_alias_maps instead.

In /etc/postfix/main.cf remove the alias_maps and alias_database like so:

#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual

Then add something like this to /etc/psotfix/virtual:

root    realuser@example.tld
user    realuser@example.tld

To make that active run:

sudo postmap /etc/postfix/virtual
sudo service postfix reload

I’m sure I figured all this out years ago, but if I did, I’d forgotten it all today!

Advertisements