I had an issue where either postfix or dovecot did not have permission to create user directories in /var/mail.

Doing ls -l '/var/mail' showed me that the owner and group was root root.

1 root root 10 May 27 13:48 /var/mail -> spool/mail

I tried changing owner and group to postfix, and then dovecot, and both times when I did a ls -l the owner and group remained as root. (this is while logged in as root).

Somebody recommended the chmod needed to be 644, so I changed it to that, and still, the server wouldn't create the user directories in the mail folders.

In the meantime, I changed chmod to 777 and everything started working, but now I have a big security concern.

Why didn't the owner and group change from root when I told it to?

Who should own /var/mail? and what chmod does it need?

  • 1
    On my Ubuntu 12.04 server /var/mail/ is owned by root mail and permissions are 775. – Paul Sep 24 '13 at 7:32

Who should own /var/mail? and what chmod does it need?

it would depend on postfix/dovecot settings. I'm using special user virtual

# groupadd -g 1981 virtual 
# useradd -g virtual -s /sbin/nologin -u 1981 virtual

# chown virtual:virtual /var/spool/mail/
# chmod 750 /var/spool/mail/

And then use the user in postfix

virtual_gid_maps = static:1981
virtual_uid_maps = static:1981

and Dovecot

first_valid_gid = 1981
last_valid_gid = 1981

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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