mercredi 31 décembre 2014

Permissions for dovecot and postfix in CentOS 7


I am using this tutorial to set up Postfix and Dovecot on a CentOS 7 web server. But when I try to send a test email using sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog, I get an error indicating that Dovecot does not have permissions to create the directory for storing the email. How do I go about setting up permissions for Dovecot and Postfix to be able to work properly in CentOS 7?


I am new to linux. I know about adduser, chmod, chown, octal permissions, and other commands, but I do not know how they all apply to this specific requirement, and I do not want to create ineffective things by experimenting without understanding.


Here is the most relevant part of the error message:



Error: user import: Initialization failed: Namespace '':
mkdir(/home/import/Maildir) failed:
Permission denied (euid=1001(import) egid=1001(import)
missing +w perm: /home/import, UNIX perms appear ok (ACL/MAC wrong?))


Here is the complete error message:



Dec 30 19:03:42 mydomain postfix/pickup[8093]: A22E78221C13: uid=1000 from=<anotherusername>
Dec 30 19:03:42 mydomain postfix/cleanup[8121]: A22E78221C13: message-id=<20141231000342.A22E78221C13@mydomain.com>
Dec 30 19:03:42 mydomain postfix/qmgr[8094]: A22E78221C13: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755)
Dec 30 19:03:42 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 19:03:42 mydomain postfix/local[8123]: A22E78221C13: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.06/0.02/0/0.07, dsn=4.3.0, status=deferred (temporary failure)


EDIT#1:


I then ran sudo chown -R newusername:newusername /home/newusername and then again repeated sudo echo "TEST" | mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog but still got the following error:



Dec 30 20:22:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:22:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:22:29 mydomain postfix/local[8450]: A22E78221C13: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=4727, delays=4727/0/0/0.08, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:24:08 mydomain postfix/pickup[8093]: E0DF28221C14: uid=1000 from=<anotherusername>
Dec 30 20:24:08 mydomain postfix/cleanup[8491]: E0DF28221C14: message-id=<20141231012408.E0DF28221C14@mydomain.com>
Dec 30 20:24:08 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 20:24:08 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:24:08 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:24:09 mydomain postfix/local[8450]: E0DF28221C14: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.13, delays=0.07/0/0/0.06, dsn=4.3.0, status=deferred (temporary failure)


Note that the preceding log leaves the terminal in an un-returnable state. I try :q and Ctrl-X, but am not able to get another prompt, so I have to close the terminal window and log in again to be able to get another command prompt. Help fixing that would be much appreciated.


The output of dovecot -n is:



# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-123.13.1.el7.x86_64 x86_64 CentOS Linux release 7.0.1406 (Core)
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_location = maildir:~/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
mbox_write_locks = fcntl
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
}
postmaster_address = me@someotherdomain.com
ssl = required
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
userdb {
driver = passwd
}


EDIT#2


Typing sudo echo "TEST" | sudo mail -s "testmail" newuser@localhost && sudo tail -f /var/log/maillog gave the following:



Dec 30 20:42:29 mydomain postfix/qmgr[8094]: E0DF28221C14: from=<anotherusername@mydomain.com>, size=463, nrcpt=1 (queue active)
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:42:29 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:42:29 mydomain postfix/local[8531]: E0DF28221C14: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=1101, delays=1101/0.02/0/0.06, dsn=4.3.0, status=deferred (temporary failure)
Dec 30 20:45:40 mydomain postfix/pickup[8529]: CF3CB80B33C4: uid=0 from=<root>
Dec 30 20:45:40 mydomain postfix/cleanup[8551]: CF3CB80B33C4: message-id=<20141231014540.CF3CB80B33C4@mydomain.com>
Dec 30 20:45:40 mydomain postfix/qmgr[8094]: CF3CB80B33C4: from=<root@mydomain.com>, size=455, nrcpt=1 (queue active)
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Error: user newusername: Initialization failed: Namespace '': mkdir(/home/newusername/Maildir) failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, UNIX perms appear ok (ACL/MAC wrong?))
Dec 30 20:45:40 mydomain dovecot: lda(newusername): Fatal: Invalid user settings. Refer to server log for more information.
Dec 30 20:45:40 mydomain postfix/local[8553]: CF3CB80B33C4: to=<newusername@localhost.com>, orig_to=<newusername@localhost>, relay=local, delay=0.15, delays=0.08/0.02/0/0.05, dsn=4.3.0, status=deferred (temporary failure)


Aucun commentaire:

Enregistrer un commentaire