How to Configure Postfix and Dovecot with Virtual Domain Users in Linux – Part 2

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Gabriel Cánepa

Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

47 Responses

  1. Richard says:

    So my problem is .. i am on the of the part 2 so i am trying setup Thunderbird but i have a problem. I can connect to my mail server and get the folders (inbox, draft, trash) and i think download mails via imap (this i can’t test because i don’t have any emails).

    But smtp still not work..Thunderbird shows me error that connection to my mail server failed and nothing shows in logs.. Telnet works i cant normally send email… Another thing when i send email from gmail to my server then gmail send me back error message.

    this is my log when i connect to sync my emails.. there are some unknown user auth-worker messages and some pam auth messages

    Oct 05 07:44:01 auth: Debug: Loading modules from directory: /usr/lib64/dovecot/auth
    Oct 05 07:44:01 auth: Debug: Module loaded: /usr/lib64/dovecot/auth/
    Oct 05 07:44:01 auth: Debug: Module loaded: /usr/lib64/dovecot/auth/
    Oct 05 07:44:01 auth: Debug: Read auth token secret from /var/run/dovecot/auth-token-secret.dat
    Oct 05 07:44:01 auth: Debug: auth client connected (pid=7486)
    Oct 05 07:44:01 auth: Debug: auth client connected (pid=7489)
    Oct 05 07:44:01 auth: Debug: client in: AUTH    1       PLAIN   service=imap    secured session=2TQQqhc+bgBY1CMG        lip=myip       rip= lport=143       rport=54382
    Oct 05 07:44:01 auth: Debug: client passdb out: CONT    1
    Oct 05 07:44:01 auth: Debug: client in: CONT
    Oct 05 07:44:01 auth-worker(7491): Debug: Loading modules from directory: /usr/lib64/dovecot/auth
    Oct 05 07:44:01 auth-worker(7491): Debug: Module loaded: /usr/lib64/dovecot/auth/
    Oct 05 07:44:01 auth-worker(7491): Debug: Module loaded: /usr/lib64/dovecot/auth/
    Oct 05 07:44:01 auth-worker(7491): Debug: pam(richardrozbrj@xxx, lookup service=dovecot
    Oct 05 07:44:01 auth-worker(7491): Debug: pam(richardrozbrj@xxx, #1/1 style=1 msg=Password:
    Oct 05 07:44:03 auth-worker(7491): Info: pam(richardrozbrj@xxx, pam_authenticate() failed: Authentication failure (password mismatch?)
    Oct 05 07:44:03 auth-worker(7491): Debug: sql(richardrozbrj@xxx, query: SELECT Email as User, password FROM Users_tbl WHERE Email='richardrozbrj@xxx';
    Oct 05 07:44:04 auth: Debug: client passdb out: OK      1       user=richardrozbrj@xxx       User=richardrozbrj@xxx
    Oct 05 07:44:04 auth: Debug: master in: REQUEST 1762394113      7489    1       1f4774e9be834b6150011787a313c10d        session_pid=7494        request_auth_token
    Oct 05 07:44:04 auth-worker(7491): Debug: passwd(richardrozbrj@xxx, lookup
    Oct 05 07:44:04 auth-worker(7491): Info: passwd(richardrozbrj@xxx, unknown user
    Oct 05 07:44:04 auth: Debug: master userdb out: USER    1762394113      richardrozbrj@xxx    uid=5000        gid=5000        home=/home/vmail/xxx/richardrozbrj/Maildir   auth_token=cd757c58520fbf318d9bccd8908aa798c536184c
    Oct 05 07:44:04 imap-login: Info: Login: user=, method=PLAIN, rip=, lip=myip, mpid=7494, TLS, session=
    Oct 05 07:44:04 imap(richardrozbrj@xxx): Debug: Effective uid=5000, gid=5000, home=/home/vmail/xxx/richardrozbrj/Maildir
    Oct 05 07:44:04 imap( Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes location=maildir:/home/vmail/xxx/richardrozbrj/Maildir
    Oct 05 07:44:04 imap( Debug: maildir++: root=/home/vmail/xx/richardrozbrj/Maildir, index=, indexpvt=, control=, inbox=/home/vmail/xxx/richardrozbrj/Maildir, alt=
  2. Richard says:

    Hi can i still ask some questions ?

    • Ravi Saive says:


      Yes, you can feel free to ask any questions related this topic..

      • Richard says:

        I am on the end of this part of tutorial… but my smtp connection via mail client doesn’t work… i can normally send email via telnet but not via client … it shows me error with smtp failed connection and no logs anywhere.

        Imap works i think because i connect and got folders so i think it can sync mail via server and client. Another thing is that when i want send email from gmail to my server it return error message to gmail that wasn’t successful.

        Is there any options how can i turn on logs for smtp ? because i trying connect but there is nothing in logs no messages for smtp.

  3. Mareg says:

    I’ve installed all as is decribed in part 1 and 2, but the postfix don’t communicate with me.
    If I try to connect at port 25 with telnet, there isn’t answer.
    Could You describe how we can test the installation and how to set postfix to log in maillog file?

    Thanks for articles/help.

  4. Rajhans says:

    Hello, Should we create users in Postfix and Dovecote to use mail server?

    Best regards

  5. Marek says:

    there’s an error in /etc/postfix/mariadb* files. line startin with “host” should be “hosts”

  6. Mareg says:

    Hello, notice the last line in the master.cfg
    ” flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}”
    must start with [space]


    • Gabriel A. Cánepa says:

      Thanks for your comment, but I never noticed this. I am confused as to why you had to do that.

      • Mareg says:

        I tried this again but its true. So if You look at examples in file, every second line with “flags” parameter had two spaces in the start of.

  7. Angel A. Martinez A. says:

    I’ve done everything step by step, but I can not send or receive any email, I opened port 25 and nothing … please some help … thank you

  8. Johnny Z says:

    Ok I have an issue with /var/log/dovecot.log, apparently it was not created during the postfix configuration.. What can I do? can I just create that file under /var/log/?

    • @Johnny,
      The log file should have been created if you followed the steps outlined in this series. What distribution are you using? If you’re using a distro other than CentOS, the file may be located somewhere else. Before creating it manually, I would do a search: find / -name “dovecot.log”.

  9. Harmon20 says:

    I’ve been using this guide as a step-by-step literal how-to. At the point with header “Configuring Dovecot” I attempted to send mail to my server using a telnet session, both from localhost and from external. Connection was refused in all cases despite firewall being open on 25. The solution was to modify to add the line:

    smtp inet n – n – 1 smtpd

    I’ve got other issues at this point, but at least the server is accepting connection and responding to ehlo now. On CentOS7.2 x64.

    • @Harmon20,
      Please refer to Part 3 ( and check Figure 1. This same instruction was provided there.

      • Harmon20 says:

        What? RTFM before posting? Why would I do that?

        BTW, the “other issues” I’ve got … spelling alias in my mariadb lookup cf as “alais”.

        I’m a doof. I’m going to keep plugging away at it anyways. Maybe I’ll have a functional server by the time I get to the end of this series.

        • I advised you to check Part 3 of this series to point out that this had been properly addressed there. This setup was tested so I don’t see why you wouldn’t have a functional server once you complete this series.

          • Harmon20 says:

            Oh, I don’t doubt the series. With stupid problems like spelling mistakes and freaking out about broken stuff before bothering to reading the entire process I’m questioning my ability to execute properly. But I’m learning plenty along the way, so I’m going to keep at it. I’ve tried a dozen different tutorials and I keep coming back to this one. It seems to make more sense and be laid out a bit more logically and informatively than most. If I can’t make it work, its on me.

        • @Harmon20,
          If for some reason you can’t make it work, don’t hesitate to let us know. I’m willing to share all the configuration files so you can compare them to your setup. We really want you to have the awesome feeling of having set up this complete mail server and make it work :).

  10. JOSE says:

    I was having the same issue receiving emails from outside, i solved it with
    firewall-cmd –add-port=25/tcp
    firewall-cmd –add-port=25/tcp –permanent

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *