Postfix (Email) - Create a new user account

by
Jeremy Canfield |
Updated: March 12 2020
| Postfix (Email) articles
Let's create a new user account named user1.
[root@server1 ~]# useradd user1
Give user1 a new password.
[root@server1 ~]# passwd user1
Create user1 mail directory.
[root@server` ~]# mkdir /home/user1/Maildir
Ensure user1 is the owner and group.
[root@server` ~]# chown user1:user1 /home/user1/Maildir
Give owner (user1) read, write, and execute permission,
[root@server` ~]# chmod 700 /home/user1/Maildir
Use the ls -l (list long) command to ensure user1 is the owner and group owner and the permissions are 700 (drwx------).
[root@server` ~]# ls -l /home/user1
drwx------. 2 user1 user1 4096 Jan 01 00:01 Maildir
Send user1 an email. This is necessary to create the following directories:
- /home/user1/Maildir/cur
- /home/user1/Maildir/new
- /home/user1/Maildir/tmp
If you have not yet enabled encryption:
[root@server1 ~]# telnet localhost 25
Trying ::1...
Connected to localhost
Escape character is '^]'.
220 mail.example.com ESMTP Postfix
EHLO localhost
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: root@example.com
250 2.1.0 Ok
rcpt to: user1@example.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Hello World
.
250 2.0.0 Ok: queued as 188B012006D
quit
221 2.0.0 Bye
Connection closed by foreign host.
If you have enabled encryption:
Connect using OpenSSL:
openssl s_client
-connect mail.example.com:587
-starttls smtp
-key /etc/pki/tls/private/mail.example.com.key
-cert /etc/pki/tls/certs/mail.example.com.crt
Send the email:
250 DSN
EHLO localhost
250-mail.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: user1@example.com
250 2.1.0 Ok
rcpt to: user2@example.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Hello World
.
250 2.0.0 Ok: queued as 188B012006D
quit
221 2.0.0 Bye
closed
Use the ls -l (list long) command to verify the cur, new, and tmp directories were created.
[root@server` ~]# ls /home/user1/Maildir
cur new tmp
Did you find this article helpful?
If so, consider buying me a coffee over at