3

I'm trying to create my first mail server with postfix, Dovecot and squirrel mail on Ubuntu 14.04

To get started did i follow this tutorial on this page. http://www.tecmint.com/setup-postfix-mail-server-in-ubuntu-debian/

I created a user on my linux server called nicolai with a random password that im using to sign in to squirrelmail.

But i keep getting this error:

ERROR: Could not complete request.
Query: SELECT "INBOX"
Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-08-11 17:31:42]

And my log file give me this error:

Aug 11 17:31:44 remedy dovecot: imap(nicolai): Error: open(/var/mail/nicolai) failed: Permission denied (euid=1001(nicolai) egid=1002(nicolai) missing +w perm: $var/mail, we're not in group 8(mail), dir owned by 0:8 mode=0775)
Aug 11 17:31:44 remedy dovecot: imap(nicolai): Error: Failed to autocreate mailbox INBOX: Internal error occurred. Refer to server log for more information. [2015-08-15-08-11 17:31:44]

So for some reason it seems like it won't create the INBOX - I checked the mail directory in my home folder and it has only created the following folders INBOX.Drafts, INBOX.Sent and INBOX.Trash

I have not been able to find a solution on the internet so I'm hoping someone else have tried the same as me before.

niiicolai
  • 39
  • 1
  • 1
  • 3
  • 1
    Either postfix or dovecot can hold the responsibility to create mailbox. Can you [edit] the post and add the output of `postconf -n` and `dovecot -n`? – masegaloeh Aug 12 '15 at 23:50
  • @masegaloeh: that´s not right: dovecot could create the mailbox: manually via `doveadm mailbox create` or with the first receiving email (if user rights on the mail folder are ok). But for a detailed answer you are right: `postconf -n` and `dovecot -n` is needed. – UsersUser Aug 19 '15 at 10:45

3 Answers3

9

The first line of the dovecot error indicates it doesn't have permission write to /var/mail/. This indicates the dovecot is running under an account without permission to write to the folder. /var/mail/ is owned by root:mail (UID/GID 0:8), giving full read/write/execute permissions to both root and the group mail. Dovecot is running under nicolai to access it, and because nicolai is not in the group mail, the folder cannot be accessed.

I'm not sure how the other inbox folders got created, but to fix this, all you should need to do is add nicolai to mail, like this:

adduser nicolai mail

That should allow nicolai to access it's mail folder, and fix the problem.

ConnorJC
  • 921
  • 1
  • 7
  • 19
  • This is a terrible idea, because it means that ol' `nicolai` now has read-write access to everyone's mail. – womble Jul 31 '20 at 02:51
0

you can add nicolai to the mail group, it worked for me

usermod -a -G mail nicolai
  • How does this differ from the other answer which recommends the same, very insecure, course of action? – womble Jul 31 '20 at 02:52
  • I agree this looks identical to the other answer – Daniel K Aug 01 '20 at 08:05
  • the command used in the answer of ConnorJC did not work for me. so I tried it this way and it fixed the problem. I am using Fedora 32. I understand its the same solution, just using a different command. – Nir Levy Aug 02 '20 at 11:21
-2

The issue could be that SELinux is blocking access for the user mentioned in your log file. If this is the case disabling SELinux enforcement should allow you to work around this. This can be done by issuing the command below:

$ setenforce 0

Be aware that SELinux is a security feature and you might want consider whether you want to disable it entirely or not.

pacey
  • 3,833
  • 1
  • 15
  • 31
JackyChan
  • 1
  • 1