4.2. Virtual users and domains

Our current setup can only receive mail for for users that exist on our server (root, the one that you created druing the installation and other system users). As you can see this is not quite helpfull as we could only server one domain and all the users that have email addresses on that domain would have to be created on the server.

To avoid all this we are going to use virtual domains and users. That means that we are going to create a couple of databases where we will store all the domains and users that we will be receiving mail for.

First, we are going to create a system user which will have persmissions to read and write emails to the system as well as the directory for storing all of the mail.

User will be called vmail and will have a group with ID 5000 on the system.

groupadd -g 5000 vmail
useradd -s /usr/sbin/nologin -g vmail -u 5000 vmail -d /home/vmail -m

The extra parameters for the useradd command tell the system that this user will not be able to log on to the system, that he belongs to group 5000 and that it's home folder is /home/vmail. This is the folder where all of the received messages will be stored.