Following from the previous article where we looked at setting up the Slice, we can move onto an important aspect of creating a mail server: configuring where the mail will be physically located on the Slice.
The easiest way is to create a 'vmail' user and assign specific IDs to that user.
Vmail user and group
Using the name 'vmail' is a common way of identifying the system user where the mail is physically located.
Note that when we use MySQl for our multiple domains and users, it does not hold the mail itself, just the details of all our users and domains.
The user is created like any other but we will specifically define the vmail group and user IDs and ensure the user cannot login (the vmail user is not one that will have login access to the Slice - it is simply somewhere central to hold the emails.).
Let's start with the vmail group:
sudo groupadd -g 5000 vmail
That creates the group and assigns the GID (group ID) of 5000
Now we can move into the vmail user:
sudo useradd -s /usr/sbin/nologin -g vmail -u 5000 vmail -d /home/vmail -m
This command creates the 'vmail' user, ensures they can't login (it is not a normal account), adds them to the 'vmail' group and creates the home directory.
Although a short article, setting the 'vmail' user and group with specific IDs is an essential part of the mail server setup.
Missing this section will mean your mail server will not work.
The next article in the series looks at installing Postfix and Mysql.