From ArchWiki
Revision as of 16:36, 1 January 2013 by Jhernberg (talk | contribs) (Configuration: Add an accuracy template regarding the new conf files dir structure)
Jump to: navigation, search

Dovecot is an IMAP and POP3 server.

The goal of this article is to setup dovecot, using PAM auth over SSL. It requires an SMTP server already working. You can follow the Sendmail guide to set up sendmail as your SMTP server.


Install the package dovecot and pam from the official repositories.

Create SSL certs

The dovecot package contains a script to create your SSL certificate and key.

  • Before you run this script, create your settings file.
# cp /etc/ssl/dovecot-openssl.cnf{.sample,}
  • Edit your /etc/ssl/dovecot-openssl.cnf according to your needs.
  • Then execute the script.
# /usr/lib/dovecot/

The cert/key pair is created under /etc/ssl/certs and /etc/ssl/private.



Reason: This section needs to be updated to reflect the new directory structure of the configuration files. (Discuss in Talk:Dovecot#)
  • Create the /etc/pam.d/dovecot file with the following content:
auth    required nullok
account required 
  • Check the correct path where you mail is stored. Normally is /var/spool/mail.
  • Edit the /etc/dovecot/dovecot.conf. Be sure you set the path of ssl_cert, ssl_key and mail_location correctly:
listen = *
ssl = yes
ssl_cert = </etc/ssl/certs/server.crt
ssl_key = </etc/ssl/private/server.key

passdb {
  driver = pam
protocols = imap pop3
service auth {
  user = root
service imap-login {
  chroot = login
  user = dovecot
service pop3-login {
  chroot = login
  user = dovecot
userdb {
  driver = passwd
  • Change permissions for the mail_location directory:
chmod 0600 /var/spool/mail/*

Start the server

Start, and optionally, enable for autostart on boot, the dovecot.service daemon.

Read Daemon for more information.