How to configure Postfix to get users from LDAP

Home > Search > How-to

This assumes your Linux Postfix server is already configured to query users from LDAP. If not, follow the OpenLDAP tutorial.

Create the file.

~]# touch /etc/postfix/


Add the hostname and base DN of your LDAP server to the file.

server_host =
search_base = dc=example,dc=com


Make sure you can query a LDAP user.

~]# postmap -q JohnDoe ldap:/etc/postfix/


Add ldap:/etc/postfix/ to the alias_maps line in your /etc/postfix/ file.

alias_maps = hash:/etc/aliases, ldap:/etc/postfix/


Restart Postfix.

~]# systemctl restart postfix


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.