Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have CentOS 5.5 with Postfix installed on it. I want to use local delivery agent with default setting, but I want it to store mail with Maildir directory style mailboxes.

When I set the mailboxes to be stored ( as default ) in:

mail_spool_directory = /var/spool/mail/

And I manually create maildir, so it looks like this:

[root@dx2200 /]# ls -lah /var/spool/mail/
total 32K
drwxrwxr-x  4 root  mail 4.0K Mar 15 15:01 .
drwxr-xr-x 13 root  root 4.0K Mar 15 14:33 ..
drwxr-xr-x  5 root  root 4.0K Mar 15 14:52 marshra
drwxr-sr-x  5 pedro mail 4.0K Mar 15 15:01 pedro
[root@dx2200 /]# 
[root@dx2200 /]# ls -lah /var/spool/mail/pedro/
total 40K
drwxr-sr-x 5 pedro mail 4.0K Mar 15 15:01 .
drwxrwxr-x 4 root  mail 4.0K Mar 15 15:01 ..
drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:01 cur
drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:01 new
drwxr-sr-x 2 pedro mail 4.0K Mar 15 15:03 tmp
[root@dx2200 /]#

And then I try to send mail to local user pedro, the message is not being delivered, and my /var/log/maillog says:

Mar 15 15:11:00 dx2200 postfix/local[4266]: warning: maildir access problem for UID/GID=1014/1014: error writing message: Permission denied
Mar 15 15:11:00 dx2200 postfix/local[4266]: warning: perhaps you need to create the maildirs in advance
Mar 15 15:11:00 dx2200 postfix/local[4266]: 8D5D11310056: to=<pedro@dx2200.it.eclocal>, orig_to=<pedro>, relay=local, delay=0.04, delays=0.02/0.01/0/0.01, dsn=5.3.0, status=bounced (maildir delivery failed: error writing message: Permission denied)

I've had similar problem with virtual delivery agent, and changing virtual_mailbox_base from /var/spool/vmail to home directory /home/vmail did help. Do I have to do it also with local delivery agent ? AND IF SO - why can't I store mail in /var/spool ?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Edit: answer completely rewritten according to comments

The issue could be related to SELinux. You can run e.g. sestatus to check if it is enabled or disabled.

For maildir delivery, postfix changes to the corresponding user, so the destination directory needs to be writable by the user. This seems to be already the case. For privacy reason, I suggest chmod -R o-rwx /var/spool/mail/*

Just for completeness: If mbox files are used, the spool directory needs to be writable by the mail group which you get by using chmod -R g+rwX /var/spool/mail.

share|improve this answer
    
I've tried, and it does not help - that is what totally dazed. –  malloc4k Mar 15 '12 at 15:17
    
My answer is not helpful (I will delete it soon), since maildir delivery is done by postfix as the corresponding user, not as mail group member. Can you check, if pedro can create and edit files in /var/spool/mail/pedro/ as expected? –  jofel Mar 15 '12 at 15:28
    
Yes, pedro can create and edit files in /var/spool/mail/pedro/ and it's subdirectories. Maybe it's something CentOS specific with /var direcotry ... ? –  malloc4k Mar 15 '12 at 15:39
    
Try chmod -R 0700 /var/spool/mail/pedro. –  jofel Mar 15 '12 at 15:49
1  
Maybe the issue is related with SELinux. You can run e.g. sestatus to check if it is enabled or disabled. –  jofel Mar 15 '12 at 19:16
show 2 more comments

I had the same error with user directories under a subdir which had the wrong permissions. For example, the home dir for "user1" was /home/subdir/user1. And subdir had no execute permissions for "others".

chmod 755 /home/subdir

fixed the issue for me. The user directories are still with "700" permissions.

The error message was misleading because the permission denied was not on the user's directory but on a directory above it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.