Mail Server : Add Mail User Accounts#22019/05/14 |
Add Mail User Accounts to use Mail Service.
This example is for the case you use virtual mail-user accounts, not use OS accounts.
|
|
[1] |
Configure
basic Postfix settings and
basic Dovecot settings first.
|
[2] | Configure additional settings to Postfix and Dovecot. |
# create a admin user for virtual mailboxes [root@mail ~]# useradd --uid 20000 --shell /sbin/nologin vmail
[root@mail ~]#
vi /etc/postfix/main.cf # line 183: comment out # mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# line 438: change home_mailbox = /home/vmail/%d/%n/Maildir # add to the end
# if specify multiple domains, specify comma or space separated
virtual_mailbox_domains = srv.world, virtual.host
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox
virtual_uid_maps = static:20000
virtual_gid_maps = static:20000
[root@mail ~]#
vi /etc/dovecot/conf.d/10-auth.conf # line 100: add auth_mechanisms = cram-md5 plain login
# line 122: comment out # !include auth-system.conf.ext
# line 125: uncomment !include auth-passwdfile.conf.ext # line 128: uncomment !include auth-static.conf.ext
[root@mail ~]#
vi /etc/dovecot/conf.d/auth-passwdfile.conf.ext # line 8: change
passdb {
driver = passwd-file
args = scheme=CRAM-MD5 username_format=%u /etc/dovecot/users
# line 11: comment out all [userdb] section #userdb { # driver = passwd-file # args = username_format=%u /etc/dovecot/users #..... #..... #}
[root@mail ~]#
vi /etc/dovecot/conf.d/auth-static.conf.ext # line 21-24: uncomment and change
userdb {
driver = static
args = uid=vmail gid=vmail home=/home/vmail/%d/%n
}
[root@mail ~]#
vi /etc/dovecot/conf.d/10-mail.conf # line 30: change mail_location = maildir: /home/vmail/%d/%n/Maildir
systemctl restart postfix dovecot
|
[3] | Add virtual mail user accounts. |
[root@mail ~]#
vi /etc/postfix/virtual-mailbox # create new # [user account] [mailbox] fedora@srv.world srv.world/fedora/Maildir/ ubuntu@srv.world srv.world/ubuntu/Maildir/ redhat@virtual.host virtual.host/redhat/Maildir/
[root@mail ~]#
postmap /etc/postfix/virtual-mailbox
# generate encrypted password [root@mail ~]# doveadm pw -s CRAM-MD5 Enter new password: Retype new password: {CRAM-MD5}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[root@mail ~]#
vi /etc/dovecot/users # create new # [user account] [password] fedora@srv.world:{CRAM-MD5}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ubuntu@srv.world:{CRAM-MD5}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx redhat@virtual.host:{CRAM-MD5}xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
[4] | That's OK. Try to test to send emails on Mail client. For this settings, specify email address for [Username] on Email Client settings. |
Sponsored Link |