0

So I run debian 10 through VMbox on win10. I am setting up an email server right now and the things that won't let me turn in this quest is that I can't receive mail from the internet though I can send it. The mail is stored in /var/mail/Maildir and subfolders like new, cur, tmp and when an email drops in, this file doesn't have the right permissions and I can't read it through thunderbird until I manually set the rights. All the new letters have -rw-------+ permissions. What can I do to make all new letters have 755 rights automatically? I really need help, I am still new to this and not being able to figure it out drives me mad.

Things I've tried:

chown -R :mail /var/mail/Maildir
chmod -R 755 /var/mail/Maildir

and

setfacl -R -m "group:mail:rwX" $dir                # Sets the effective ACL.
setfacl -R -d -m "group:mail:rwX" $dir             # Sets the inheritable ACL.

But still I can't get the permissions right. I use passwd database as a driver so all the users are local debian users like root or alex united by "mail" group.

In logs I have this:

Jul 21 21:42:15 mail dovecot: imap(alex)<2920><4nRq+/eqcMl/AAAB>: Error: Mailbox INBOX: open(/var/mail/Maildir/cur/1595355455.Vfe04Idf939M195657.mail.magrega.ru.eu.org:2,) failed: Permission denied (euid=1003(alex) egid=1004(alex) missing +r perm: /var/mail/Maildir/cur/1595355455.Vfe04Idf939M195657.mail.magrega.ru.eu.org:2,)
Jul 21 21:42:15 mail dovecot: imap(alex)<2920><4nRq+/eqcMl/AAAB>: FETCH failed: Internal error occurred. Refer to server log for more information. [2020-07-21 21:42:15] in=275 out=1023 deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 body_bytes=0

I enter chmod g+r var/mail/Maildir/cur/ and everything starts working until I get a new mail which has only -rw------+ permissions.

magrega
  • 1
  • 1

1 Answers1

0

Maildir is typically stored in a user's home directory and postfix will chown the new file so that the recipient user owns it.

If you are trying to store it in /var/mail then the user who is receiving the mail needs to be that directory owner, otherwise the chown by postfix won't work. In your question, it looks like that would be alex.

Each local user should have their own Maildir. Trying to dump all mail into a single systemwide Maildir is asking for trouble. If you really want everything to end up in a single Maildir, then handle the REDIRECT within postfix and then let it deliver normally.

tater
  • 1,395
  • 2
  • 9
  • 12