I'm trying to setup a mail server ! Everything seems to be ok (after some loooong days) but when I tried to read mail with IMAP server :
Apr 18 17:38:48 sd-84941 dovecot: imap(dlp): Error: open(/data/maildir/dlp/cur/1460993401.13028_0.sd-84941:2,) failed: Permission denied (euid=1000(michael) egid=1000(michael) missing +r perm: /data/maildir/dlp/cur/1460993401.13028_0.sd-84941:2,, we're not in group 8(mail), dir owned by 0:8 mode=0777)
Mails are in the maildir folder but I can't read them because of permissions...
-rw-rw---- 1 root root 2363 Apr 18 17:55 1460994924.16416_0.sd-84941
But if chmod 777 It work (but I can't do this by hand everytimes..) :
-rwxrwxrwx 1 root root 2363 Apr 18 17:55 1460994924.16416_0.sd-84941:2,
What's happen ? Who give file permission ? fetchmail, procmail or dovecot ?
----- Edit ------
Thanks for your answers, @tripleee. I 'll try to give details :
I've installed sendmail, procmail, fetchmail, dovecot & roundcube :
Sendmail & Roundcube : default install.
Procmail :
In /etc/procmailrc (I prefer a global conf vs the user way), we have :
MAILDIR=/data/mails/ DEFAULT=$MAILDIR/ LOGFILE=/var/log/procmail VERBOSE=on
- Fetchmail
In /etc/fetchmailrc :
set syslog set daemon 120 poll mail.interpc.fr with nodns, with protocol POP3, user "dlp", with password mypass option keep
- dovecot
I've created a vmail user :
sudo addgroup --gid 5000 vmail sudo adduser --home /data/mails/ --uid 5000 --gid 5000 --shell /bin/false vmail
In /etc/dovecot/users (with vmail's uid & gid) :
dlp:{PLAIN}mypass:5000:5000::
In /etc/dovecot/conf.d/10-auth.conf, I've changed to :
disable_plaintext_auth = no #!include auth-system.conf.ext !include auth-passwdfile.conf.ext
In /etc/dovecot/conf.d/10-mail.conf : mail_location = maildir:/data/mails/
- Problem description : mails are copied to my mail folder but with root permissions so Roundcube can't open mails
root@sd-84941:/home/michael# ls -al /data/mails/cur/ total 48 drwxr--r-- 2 vmail vmail 4096 Apr 21 15:08 . drwxr--r-- 5 vmail vmail 4096 Apr 21 15:08 .. -rwxr--r-- 1 root root 29635 Apr 21 13:31 1461238276.4519_0.sd-84941:2, -rwxr--r-- 1 root root 3740 Apr 21 13:45 1461239150.5706_0.sd-84941:2, -rw-r--r-- 1 root root 2953 Apr 21 15:04 1461243887.17704_0.sd-84941:2,
Thanks for helping me...
chmod 777
anything, ever unless you know exactly what you are doing. Creating world-writable root-owned files is a recipe for disaster.root
and have an/etc/procmailrc
which creates directories, it could be the culprit./data/maildir/dlp
is owned by the wrong user, but again, with only guesses as to what it's supposed to be, you'll need to add more details if you need more help.DROPPRIVS=yes
but if Procmail doesn't know which user to switch to, what can it do? My recommendation would be to remove Procmail from the combo entirely at this point, as your Procmail recipe doesn't appear to do anything useful (which could not otherwise be configured directly in Sendmail or Postfix; I'd certainly recommend switching to the latter if you do not have monumental reasons to choose the former, but that's outside the scope of this discussion).