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: I then ran sudo chown -R newusername:newusername /home/newusername and then again repeated sudo echo TEST | sudo mail -s testmail newuser@localhost && sudo tail -f /var/log/maillog but still got the following error:  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)ANSWER: This problem was due to SELinux.  I resolved the problem by sudo nano /etc/sysconfig/selinux and then setting SELINUX=disabled.  This is acceptable during development.  A more complete solution will be to set up an SELinux rule allowing postfix and dovecot to function before this goes into production.  Note: Seven-Hundred-and-Forty-Two suggestion that I check SELinux status, so I am marking his as the correct answer.
ACL/MAC Permissions for dovecot and postfix in CentOS 7
centos;email;postfix;dovecot
The key is here: failed: Permission denied (euid=1001(newusername) egid=1001(newusername) missing +w perm: /home/newusername, dir owned by 0:0 mode=0755Dovecot is trying to write to /home/newusername/{whatever your maildir is} as newusername:newusername, however, the directory is owned by user 0:0 (root).  Because the permission mode is 755, only the owner has +w permissionsAlso, ensure that if you are using SELinux that your ACLs allow dovecot to write to your maildir