iRedMail ships 2 scripts to help you create many mail users quickly.
tools/create_mail_user_OpenLDAP.sh
(shell script) will connect to LDAP
server and add accounts directly.tools/create_mail_user_OpenLDAP.py
(Python script) will read mail accounts
from a plain text file and generate a LDIF file, you can import this LDIF
file to create mail users.Open this script and update some variables related to your LDAP server (note:
you can find them in iRedMail.tips
file):
LDAP_SUFFIX
: the ldap suffix of your OpenLDAP server. default is
dc=example,dc=com
BINDPW
: password of LDAP root dn (cn=Manager,dc=example,dc=com
).Notes:
DEFAULT_PASSWD
with new password and set USE_DEFAULT_PASSWD='YES'
.PASSWORD_SCHEME
(or CRYPT_MECH
in
old iRedMail releases), default is SSHA
.QUOTA
, default is
1048576000
(100 MB, equals to 100 * 1024 * 1024).domain.ltd/u/s/e/username-20150929
. If you
prefer domain.ltd/username/
, please set MAILDIR_STYLE='normal'
.STORAGE_BASE_DIRECTORY
, default
is /var/vmail/vmail1
.Create mail users:
# cd iRedMail-0.9.2/tools/
# bash create_mail_user_OpenLDAP.sh example.com user1 user2 user3
It will create users user1@example.com
, user2@example.com
, user3@example.com
.
Note: you don't need to create the mail domain name example.com
with iRedAdmin first.
tools/create_mail_user_OpenLDAP.py
will read mail accounts from a plain
text file and generate a LDIF file, you can import this LDIF file to create
mail users.
The plain text file format is:
domain name, username, password, [common name], [quota_in_bytes], [groups]
Note: domain name, username and password are required, others are optional.
@domain.com
part in username.@domain.com
part. for example,
use support
for group support@domain.com
. The @domain.com
part
will be appended automaticly.:
.3 examples:
mydomain.com, user1, plain_password, John Smith, 104857600, group1:group2
mydomain.com, user2, plain_password, Michael Jordan, ,
mydomain.com, user3, plain_password, , 104857600, group1:group2
mydomain.com
with iRedAdmin first.my_users.csv
:# cd iRedMail-0.9.2/tools/
# python create_mail_user_OpenLDAP.py my_users.csv
It will generate a plain LDIF file my_users.csv.ldif
under current directory,
you can import it (after reviewed the LDIF data) with command ldapadd
like
below:
# ldapadd -x -D cn=Manager,dc=example,dc=com -W -f the_output_file.ldif
Notes:
cn=Manager,dc=example,dc=com
by the real LDAP root dn.the_output_file.ldif
by the real output file.Additional Notes:
DEFAULT_PASSWORD_SCHEME
, default is
SSHA
.domain.ltd/u/s/e/username-20150929
. If you
prefer domain.ltd/username/
, please set HASHED_MAILDIR = False
.STORAGE_BASE_DIRECTORY
, default
is /var/vmail/vmail1
.