suther
suther

Reputation: 13608

What are the right permissions on dovecot /var/vmail ( on ispconfig, Debian)

If you do a migration from courier to dovecot and copy all the files from the old Server to the new ISPConfig one with Dovecot, you may got trouble with permissions.

The Mail-Logs may show messages like this one:

Nov 19 14:09:44 yourServerName dovecot: lda([email protected]): Error: open(/var/vmail/badabim.com/info/Maildir/maildirsize) failed: Permission denied

or

failed: Permission denied (euid=5000(vmail) egid=5000(vmail) missing +r perm: /var/vmail/badabim.com/info/Maildir/cur/cur:2,S)

Whats now the right permissions?

Upvotes: 1

Views: 4546

Answers (1)

suther
suther

Reputation: 13608

I have figured out this commands to set the permissions in the right way. Copy it to an File (for example /var/vmail/chmod_vmail) an make it executeable.

If you are now in a subfolder of /var/vmail, (or this folder themself), all you have to do is to execute the script.

chown vmail:vmail /var/vmail/ -R
find . -type d -name Maildir -exec chmod 700 -R {} \;
find . -type f \( -name '.sieve' -o -name '.sieve.svbin' \) -exec chmod 644 {} \;
find . -type f \( -name 'courierimapsubscribed' -o -name 'subscriptions' \) -exec chmod 744 {} \;
find . -type f \( -name 'dovecot-uidlist' -o -name 'dovecot-uidvalidity' -o -name 'dovecot.index.cache' -o -name 'dovecot.index.log' -o -name 'maildirsize'  \) -exec chmod 600 {} \;
find . -type f \( -name 'dovecot-uidvalidity.*'  \) -exec chmod 444 {} \;

Enjoy and don't forgot to rate for this answer, or post an enhancement of this code.

Upvotes: 6

Related Questions