Dovecot – Correct File Permissions for /etc/dovecot on Ubuntu 18.04

dovecotubuntu-18.04

I can't log in to my newly self-hosted webmail and I'm getting the following entries in /var/log/mail.log

Feb 10 02:00:31 ip-172-26-15-53 dovecot: lmtp(myemailuser@example.co.uk): Error: open(
/etc/dovecot/sieve/before.d/no-spam.svbin.ip-172-26-15-53.31363.94959b0f9050164f) failed: R
ead-only file system
Feb 10 02:00:31 ip-172-26-15-53 dovecot: lmtp(myemailuser@example.co.uk): Error: wEGGI
j+5QF6DegAAAPOhIQ: sieve: binary save: failed to create temporary file: open(/etc/dovecot/s
ieve/before.d/no-spam.svbin.) failed: Read-only file system

It looks to be a permissions problem. I've tried the suggestions here

My install is at /etc/dovecot and permissions are

-rwxrwx---   1 vmail dovecot 

Dovecot was installed on Ubuntu 18.04 (Amazon lightsail) using the following playbook:

https://github.com/codecowboy/sovereign/blob/master/roles/mailserver/tasks/dovecot.yml

Dovecot version is 2.2.33.2 (d6601f4ec)

Mailbox is stored on an encfs volume

Best Answer

The systemd unit, which controls dovecot has ProtectSystem set to full or strict, which prevents the processes from writing to /etc.

Add to the unit file /etc/systemd/system/multi-user.target.wants/dovecot.service an exception for this directory:

ReadWritePaths=/etc/dovecot/sieve/before.d/

Reload the units with:

systemctl daemon-reload

And restart dovecot with:

systemctl restart dovecot

Related Topic