I've just spent several hours in the middle of the night trying to migrate a Maildir setup from Centos 5.6 to Centos 7.2. I found dozens of hits on how to do this, all completely useless - a few gave specific permissions, but without file ownership, for example. A straight copy of the Maildir directory structure didn't work.
I've now got a working setup (no SELinux), through trial and error, but with various question marks, and possibly some holes. I'd appreciate feedback on whether this can be improved.
In this setup Maildir is in the user's home directory (say, /home/joe
, or ~
):
~
must haveo+x
(on this system, owner isjoe:joe
, perms711
)~/Maildir
must be owned byjoe:vmail
, perms775
. The perms are important - theg
7 appears to be copied to newly-created messages (as 6)- the procmailrc
UMASK
is completely irrelevant, unless it takes away any of these permissions - just ignore it - everything under Maildir must be owned by
joe:vmail
, with directories given perms775
, and regular files660
- When procmail eventually creates a file under, for example,
Maildir/cur
it creates it with ownerjoe:mail
(notvmail
), perms664
- practically any change to the above will cause either a sendmail, dovecot or procmail failure at some point in the delivery process.
Quick hack script below - run from /home, supply a username.
#!/bin/bash
if [ ! -d "$1" ]; then
exit 1
fi
echo "Fixing $1..."
chmod o+x "$1"
cd "$1"
chown -R "$1":vmail Maildir
find Maildir -type d -exec chmod 775 {} \;
find Maildir -type f -exec chmod 660 {} \;