Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I thought I had my postfix configuration all set up on my Amazon Ubuntu server but I guess not. I'm trying to set up an admin email account for 3 virtually hosted Apache websites. Here's my postfix file:

myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =,, , localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

virtual_mailbox_domains =,,
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:115
virtual_gid_maps = static:115
virtual_alias_maps = hash:/etc/postfix/virtual

Here's my vmailbox file:                                                               

And finally my virtual file:                 postmaster                 postmaster                 postmaster

When I try to send an email to through netcat to my one of my domains, I get:

unable to create lock file /var/mail/vhosts/ Permission denied

This is despite the fact that I set group to postfix and also my virtual_uid_maps and virtual_gid_maps are both set to Postfix group id of 115.

share|improve this question
Does the postfix group have rwx rights on that folder? – Laurentiu Roescu Nov 13 '12 at 6:33
@LaurentiuRoescu It did not. I chmodded the directory to 0775 from 0755. The permissions are now: drwxrwsr-x 2 root postfix 4096 Nov 13 10:58 /var/mail/vhosts/ It works perfectly now. Post your answer as official so I can accept it. Thanks! – John Bowlinger Nov 13 '12 at 16:04
I'll be a little more precise: Whatever GID you set in virtual_gid_maps needs to have write access to the folder. Other than that, this information was exactly what I was looking for. (For various reasons, I had set my virtual_gid_maps value to a different number than the group number for postfix, so just setting the group to postfix and setting the permissions as described did not resolve my issue.) A few minutes of thinking about it made it clear where I was screwing up, and I hope this helps someone else. – user152402 Jan 7 '13 at 18:53
up vote 5 down vote accepted

The postfix group should have Read/Write/Execute permissions on the /var/mail/vhosts folder.

share|improve this answer

Your Answer


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.