Adding an E-Mail Account via Ssh

Here I will show you how to add a new email account using SSH.

In this example we will be adding a user named Joe to the domain brightlemon.com

 useradd  -s /sbin/nologin joe
 passwd  joe 

Enter a password for joe. You will be prompted to enter it again.

vi /etc/postfix/virtual

Press [INSERT] to switch vi to edit mode and enter the following at the bottom of the file.

joe@brightlemon.com joe

Press [ESCAPE] and type

 :x  

before pressing [ENTER]. This will save the file.

You then need to postmap your changes.

 postmap  /etc/postfix/virtual 

Restart postfix with the following command. Depending on your server configuration one of the following 2 commands will work correctly.

service postfix restart
/etc/init.d/postfix restart

The email to joe@brightlemon.com is now configured correctly and can be connected via POP3

Useful links:

BrightLemon