Dovecot Permissions

Well, I finally bit the bullet and installed OS X Snow Leopard Server. Most of what I absolutely need to get working is mail services. One of the peculiarities of Dovecot is that each users mail folder is owned by that user. I think in Cyrus they were all owned by mail or _cyrus.

Anyway, I found that a couple of my files didn’t have the correct permissions and I found out by trying to open in webmail. It gave me errors I’d never seen before. Where I found better errors was in mailaccess.log where I saw a dovecot service with a failed: Permission denied error.

I managed to find where the files lived and as I have quite a few mail users I didn’t want to go through individually so I figured out a script to do it.

sudo ls -lA /var/spool/imap/dovecot/mail | grep -v total | awk {'printf $3": /var/spool/imap/dovecot/mail/"$9"\n"'} | xargs -n2 -p sudo chown -R

The script will ask if you want to proceed with the chown command for each user.

If you find your logs reporting permissions issues with a specific account or your webmail users have errors opening mailboxes, then the following script when provided with the offending GeneratedUID will reset the permissions similar to the above. Simply replace the GUID in the script with the one listed in your logs.

dscl /LDAPv3/127.0.0.1 -list /Users GeneratedUID | grep GUID | awk {'printf $1": /var/spool/imap/dovecot/mail/"$2"\n"'} | xargs -n2 -p sudo chown -R

Related posts:

  1. Fail2ban and OS X Server, part deux As some of you might know I run my own...
  2. Server-Side Email Filtering with Sieve Another post for the peripheral brain. When I first set...
  3. Snow Leopard Sieve Rules How to edit sieve rules in Snow Leopard by hand....
  4. Fixing cyrus Yeah, I did something stupid and had to reinstall my...
  5. Forwarding Email in Leopard Server OK, to put it mildly the Workgroup Manager and Email...

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in mac-osx, osx-server and tagged , , . Bookmark the permalink.

2 Responses to Dovecot Permissions

  1. Fred says:

    Hi Andy,

    Try to figure out how to move a Dovecot Maildir contents including all folders created by local user (var/spool/imap/dovecot/mail/ ->) to a OpenDir user-store as part of migrating the user. Did not find a good source yet for this problem, maybe you have some idea?

  2. Andy says:

    You might check out the Mac OS X Server email list. Sorry I can’t help.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.