Difference between revisions of "Dovecot"

From ArchWiki
Jump to: navigation, search
(Major rewrite)
(PAM Authentication: wording)
Line 31: Line 31:
===PAM Authentication===
===PAM Authentication===
* To configure the server to use PAM for authentication, create {{ic|/etc/pam.d/dovecot}} with the following content:
* To configure PAM for dovecot, create {{ic|/etc/pam.d/dovecot}} with the following content:
auth    required        pam_unix.so nullok
auth    required        pam_unix.so nullok

Revision as of 09:51, 2 January 2013

This article describes how to set up a mail server suitable for personal or small office use.

Dovecot is an open source IMAP and POP3 server for Linux/UNIX-like systems, written primarily with security in mind. Developed by Timo Sirainen, Dovecot was first released in July 2002. Dovecot primarily aims to be a lightweight, fast and easy to set up open source mailserver. For more detailed information, please see the official Dovecot Wiki.


Install the packages dovecot and pam from the official repositories.



  • The server uses PAM to authenticate the user.
  • It uses SSL to encrypt the authentication password.
  • It uses the common Maildir format to store the mail in the user's home directory.
  • A MTA has already been set up to deliver mail, see the Sendmail guide for information on how to set up sendmail as a SMTP server.

Create the SSL certificate

The dovecot package contains a script to generate the server SSL certificate.

  • Copy the configuration file from the sample file: # cp /etc/ssl/dovecot-openssl.cnf{.sample,} .
  • Edit /etc/ssl/dovecot-openssl.cnf to configure the certificate.
  • Execute # /usr/lib/dovecot/mkcert.sh to generate the certificate.

The certificate/key pair is created as /etc/ssl/certs/dovecot.pem and /etc/ssl/private/dovecot.pem.

PAM Authentication

  • To configure PAM for dovecot, create /etc/pam.d/dovecot with the following content:
auth    required        pam_unix.so nullok
account required        pam_unix.so 

Dovecot configuration

  • Copy the dovecot.conf and conf.d configuration files from /usr/share/doc/dovecot/example-config to /etc/dovecot:
# cp /usr/share/doc/dovecot/example-config/dovecot.conf /etc/dovecot
# cp -r /usr/share/doc/dovecot/example-config/conf.d /etc/dovecot

The default configuration is ok for most systems, but make sure to read through the configuration files to see what options are available. See the quick configuration guide and dovecot configuration for more instructions.

By default dovecot will try to detect what mail storage system is in use on the system. To use the Maildir format edit /etc/dovecot/conf.d/10-mail.conf to set mail_location = maildir:~/Maildir.

Start the server

Use the standard systemd syntax to control the dovecot.service daemon.