Adding e-mail accounts
In this recipe, we will learn how to add e-mail accounts to Postfix. The easiest way to add a new e-mail account to Postfix is to add a new user account on your server. Postfix will check for user accounts and deliver e-mails to respective users. We will create a virtual user setup so that we do not need to create user accounts for each e-mail user.
Getting ready
You will need access to a root account or an account with sudo
privileges.
I assume that you have completed your basic Postfix setup and that it is working properly.
How to do it…
Follow these steps to add e-mail account:
- Create a new user account:
$ useradd -s /usr/bin/nologin -m vmail
- Get the UID and GID for this account:
$ grep vmail /etc/passwd vmail:x:1001:1001::/home/vmail:/usr/bin/nologin
- Create a base directory layout for domains and users:
$ sudo mkdir -p /home/vmail/example.org/bob $ sudo mkdir -p /home/vmail/example.net/alice
- Allow only the user vmail to access these files:
$ sudo chown -R vmail:vmail...