To be able to store the e-mail for your users you have to setup a location that will be used on your servers harddisk. A very common location is ‘/usr/local/virtual‘, but you can put it anywhere you want. Keep in mind that if you use a different location that you need to change this location in the configuration files that we’ll create later on.
For lots of reasons that go beyond these instructions (security is the largest of them) we need to create a new user called ‘vmail’ on your server, this user account will be used by all programs to access the virtual mail folders. The user has no password or user directory.
sudo niutil -createprop / /users/vmail uid 102
sudo niutil -createprop / /users/vmail gid 102
sudo niutil -createprop / /users/vmail shell "/usr/bin/false"
sudo niutil -createprop / /users/vmail home "/var/empty"
sudo niutil -createprop / /users/vmail passwd "*"
If you are installing for the first time the directory isn’t there yet. You need to create it and setup the correct permissions. So login to a Terminal session of your server and execute the following commands or use the shell script provided at the bottom of this page.
First create the required directory:
Change the owner and group of the directory to be vmail so that the postfix program can read and write into that directory:
and setup the correct permissions
Next step: Configuring SASL for SMTP authentication


11:43 am
Your articles are extremely useful, much appreciated.
Just a small note also that in the first code block you have:
/users/vmail home “/var/emtpy”
Note the typo.
Cheers
9:09 pm
Corrected….
6:57 pm
Any idea who one performs this stage on Leopard. niutil does not seem to be included any more.
8:12 pm
Yes, I’m working on it. You need to use ‘dscl’ give me a few days to update the docs.
6:28 am
Any progress? I created the account using the GUI and used the dscl -create flag from the example to set what I think are the correct directories…
8:34 am
Yes there is progress but not finished yet. I’m very busy with work at the moment which stalled progress. Any particular problem you are running into ?
9:08 pm
The upgrade to Leopard is still in progress but there was an update on the progress posted in the blog which might answer some of your questions.
12:08 am
This seems to work.
sudo dscl . -create /Users/vmail
sudo dscl . -createprop /Users/vmail uid 102
sudo dscl . -createprop /Users/vmail gid 102
sudo dscl . -createprop /Users/vmail shell “/usr/bin/false”
sudo dscl . -createprop /Users/vmail home “/var/empty”
sudo dscl . -createprop /Users/vmail passwd “*”
sudo mkdir /usr/local/virtual
sudo chown -R vmail:postfix /usr/local/virtual
sudo chmod 771 /usr/local/virtual