10

I have postfix set up and a local user myuser.

An email to myuser@mydomain.com is arriving without problems, so the basic postfix setup is fine.

I have then set up virtual alias:

mylongname@mydomain.com    myuser@mydomain.com

and in main.cf:

mydestination: mydomain, localdomain
virtual_alias_maps = hash:/path_to_virtual_aliases

I also created the database with postmap /path_to_virtual_aliases

When I send an email to mylongname@mydomain.com, I get this error:

postfix/local[2341]: error: open database /etc/aliases.db: No such file or directory
postfix/local[2341]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
postfix/local[2341]: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory
postfix/local[2341]: warning: hash:/etc/aliases: lookup of 'myuser' failed
postfix/local[2340]: F1D9C233E9A: to=<myuser@localdomain>, orig_to=<mylongname@mydomain.com>, relay=local, delay=2239, delays=2239/0.03/0/0.02, dsn=4.3.0, status=deferred (alias database unavailable)

Why does it try to look up myuser, when it is already a native user?

And if it really has to look it up, will the problem be fixed by setting up /etc/aliases? And if yes, how to do so?

1 Answers1

17

I think you are mixing up two forms of aliasing which are used at different stages of delivery.

  • virtual_alias_maps are a feature of postfix which let it completely re-route an email. They are used at a stage before postfix has decided what to do with an email and thus can be used to re-route specific email to a completely different email server.
  • alias_maps are a feature of posftix's local delivery which allow one local mail box to be aliased as another local mail box. They are used at a stage after postfix has decided to deliver the email locally and so cannot be used to re-route to another server. See here:

    DESCRIPTION: The aliases(5) table provides a system-wide mechanism to redirect mail for local recipients. The redirections are processed by the Postfix local(8) delivery agent.


Why does it try to look up myuser, when it is already a native user?

This is applied to all local users and can be very useful where you are receiving mail that isn't covered by virtual_alias_domains. For example redirecting email for many system services into one mail box.


And if it really has to look it up, will the problem be fixed by setting up /etc/aliases? And if yes, how to do so?

Yes, just create an empty /etc/aliases then populate /etc/aliases.db file with postalias:

postalias /etc/aliases