Hi all,
I'm upgrading my old F9 mail server to Centos 7 and all is going well. However, I've got a problem with recently created users.
I've rsync'd /home and /var/spool/mail after moving /etc/passwd and /etc/group
I used the default locations on the old F9 server, i.e. mail delivered to /var/spool/mail/%u by EXIM and Dovecot using that as the inbox.
Dovecot then used ~/mail/ as it's folder dir.
On the new server this works fine for any user where ~/mail/ already exists, but for any user where ~/mail/ does not exist Dovecot fails.
I've done some googling and have tried a number of settings, the most popular one being
mail_location = mbox:~/:INBOX=/var/spool/mail/%u
However, I haven't managed to fix the problem. Anyone know what I need to do next?
Below hopefully is enough for someone to see what I've got wrong. They're done with mail_location set to the default, i.e. commented out in 10-mail.conf
I've also put the log file up at http://www.stainburn.com/centos.log which should be easier to read.
cpage is an established user, tdegg is a new one. As I say below, I have found a work-around but even that still has errors.
[root@ollie2 home]# for F in cpage tdegg ; do ls -lad /home/$F /home/$F/* /home/$F/.* /home/$F/* /home/$F/mail/* /home/$F/mail/.* /home/$F/mail/.imap/* /var/spool/mail/$F ; done ls: cannot access /home/cpage/mail/*: No such file or directory drwx------ 5 cpage cpage 125 Mar 31 2009 /home/cpage drwx------ 5 cpage cpage 125 Mar 31 2009 /home/cpage/. drwxr-xr-x. 208 root root 8192 Aug 24 13:27 /home/cpage/.. -rw-r--r-- 1 cpage cpage 18 Feb 29 2008 /home/cpage/.bash_logout -rw-r--r-- 1 cpage cpage 176 Feb 29 2008 /home/cpage/.bash_profile -rw-r--r-- 1 cpage cpage 124 Feb 29 2008 /home/cpage/.bashrc drwxr-xr-x 2 cpage cpage 6 Apr 6 2008 /home/cpage/.gnome2 -rw-r--r-- 1 cpage cpage 120 Mar 31 2009 /home/cpage/.gtkrc drwx------ 3 cpage cpage 18 Mar 31 2009 /home/cpage/mail drwx------ 3 cpage cpage 18 Mar 31 2009 /home/cpage/mail drwx------ 3 cpage cpage 18 Mar 31 2009 /home/cpage/mail/. drwx------ 5 cpage cpage 125 Mar 31 2009 /home/cpage/mail/.. drwx------ 3 cpage cpage 18 Mar 31 2009 /home/cpage/mail/.imap drwx------ 2 cpage cpage 4096 Aug 24 16:21 /home/cpage/mail/.imap/INBOX drwxr-xr-x 4 cpage cpage 37 Nov 20 2008 /home/cpage/.mozilla -rw-r--r-- 1 cpage cpage 658 Mar 31 2009 /home/cpage/.zshrc -rw-rw---- 1 cpage mail 352512344 Aug 24 13:28 /var/spool/mail/cpage ls: cannot access /home/tdegg/*: No such file or directory ls: cannot access /home/tdegg/*: No such file or directory ls: cannot access /home/tdegg/mail/*: No such file or directory ls: cannot access /home/tdegg/mail/.*: No such file or directory ls: cannot access /home/tdegg/mail/.imap/*: No such file or directory drwx------ 4 tdegg tdegg 88 Aug 24 16:17 /home/tdegg drwx------ 4 tdegg tdegg 88 Aug 24 16:17 /home/tdegg/. drwxr-xr-x. 208 root root 8192 Aug 24 13:27 /home/tdegg/.. -rw-r--r-- 1 tdegg tdegg 18 Oct 23 2008 /home/tdegg/.bash_logout -rw-r--r-- 1 tdegg tdegg 176 Oct 23 2008 /home/tdegg/.bash_profile -rw-r--r-- 1 tdegg tdegg 124 Oct 23 2008 /home/tdegg/.bashrc drwxr-xr-x 2 tdegg tdegg 6 Apr 6 2008 /home/tdegg/.gnome2 drwxr-xr-x 4 tdegg tdegg 37 Nov 20 2008 /home/tdegg/.mozilla -rw-rw---- 1 tdegg mail 209466 Jun 10 11:29 /var/spool/mail/tdegg [root@ollie2 home]#
[root@ollie2 ~]# telnet 127.0.0.1 110 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. +OK Dovecot ready. user cpage +OK pass ******** +OK Logged in. stat +OK 2812 356812518 quit +OK Logging out. Connection closed by foreign host. [root@ollie2 ~]# telnet 127.0.0.1 110 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. +OK Dovecot ready. user tdegg +OK pass ******** -ERR [SYS/TEMP] Internal error occurred. Refer to server log for more information. Connection closed by foreign host.
I have found that if I manually intervene, and issue the following commands, things start to work, although I still get errors. Hopefully I get find out how to fix my Dovecot config so that I don't have to do this every time I set up a new user.
[root@ollie2 home]# mkdir -p ~tdegg//mail/.imap/INBOX [root@ollie2 home]# chown -R tdegg:tdegg ~tdegg/mail
[root@ollie2 home]# telnet 127.0.0.1 110 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. +OK Dovecot ready. user tdegg +OK pass ******* +OK Logged in. list +OK 19 messages: 1 1099 2 1026 3 1842 4 2053 5 7481 6 25063 7 1275 8 1484 9 19089 10 125054 11 3468 12 3490 13 3490 14 961 15 3177 16 3487 17 3897 18 3895 19 1001 . quit +OK Logging out. Connection closed by foreign host. [root@ollie2 home]#
Aug 24 16:42:31 ollie2 dovecot: pop3-login: Login: user=<tdegg>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=130939, secured, session=<K7wxdxAefQB/AAAB> Aug 24 16:42:31 ollie2 dovecot: pop3(tdegg): Error: fchown(/home/tdegg/mail/.imap/INBOX/dovecot.index.log.newlock, group=12 (mail)) failed: Operation not permitted (egid=2046(tdegg), group based on /var/mail/tdegg - see http://wiki2.dovecot.org/Errors/ChgrpNoPerm) Aug 24 16:42:31 ollie2 dovecot: pop3(tdegg): Error: fchown(/home/tdegg/mail/.imap/INBOX/dovecot.index.cache.lock, group=12(mail)) failed: Operation not permitted (egid=2046(tdegg), group based on /var/mail/tdegg - see http://wiki2.dovecot.org/Errors/ChgrpNoPerm) Aug 24 16:42:37 ollie2 dovecot: pop3(tdegg): Disconnected: Logged out top=0/0, retr=0/0, del=0/19, size=212332
On Mon, Aug 24, 2015 at 07:53:49PM +0100, Gary Stainburn wrote:
I used the default locations on the old F9 server, i.e. mail delivered to /var/spool/mail/%u by EXIM and Dovecot using that as the inbox.
Dovecot then used ~/mail/ as it's folder dir.
On the new server this works fine for any user where ~/mail/ already exists, but for any user where ~/mail/ does not exist Dovecot fails.
It could be SELinux:
% matchpathcon /home/anyone/mail /home/anyone/mail unconfined_u:object_r:user_home_t:s0
You might need to make the mail directory be named Maildir:
% matchpathcon /home/anyone/Maildir /home/anyone/Maildir unconfined_u:object_r:mail_home_rw_t:s0
I suspect that Dovecot isn't allowed to create 'mail' but is allowed to create Maildir by the default policy.