Emos-Batch create (delete) accounts
1. Import mail accounts in batches
After the mail system is configured properly, you can manage mail accounts on the Web Management page. However, if you have a large number of accounts, it is recommended that you create them manually, extmail provides the userctl tool for batch Account creation. PL (stored in the/var/www/extsuite/extman/tools directory ),
Sort account and password information, create a script in the following format (one line for each account), save it in the tools directory, execute the script, and all accounts can create
./Userctl. pl -- mode = add -- name = electrobrain-Michael Zhang -- username = zhangs@dadi.com -- domain = dadi.com -- Password = zpasswd -- quota = 500 -- setuid = 1000 -- setgid = 1000
Note:
1. this command has multiple parameters, commonly used for name (Common name), username (email account), domain (account domain), password (account password, if in extmail. CF and extman. when CF is set to ciphertext, it will rotate to ciphertext for storage), quota (Mail quota), and so on. unspecified parameters are automatically set to the default value.
2. The mail account information is stored in the mailbox table of the MySQL database. Someone may ask, can I create an account record directly in the database? This is not the case, because in addition to adding new notes to the database, the new account also creates a mail storage directory in \ home \ Domains \ Domain Name
3. when creating an email account, create a mailbox table and then an aliase table. If an account exists in the username column of the aliase table, accounts cannot be imported into the mailbox table (if an alias is set)
4. Check whether the account is abnormal/usr/sbin/authtest-s login ZH [email protected] zpasswd
The following information is displayed:
[Email protected] tools] #/usr/sbin/authtest-s login ZH [email protected] zpasswd
Authentication succeeded.
Authenticated: [email protected] (UID 1000, Gid 1000)
Home Directory:/home/domains/A0/B0/dadi.com/4e/f7/zhangs
Maildir:/home/domains/A0/B0/dadi.com/4e/f7/zhangs/maildir/
Quota: 524288000 s
Encrypted password: $1 $ fij/clcj $ erkdp9jeqwxie ztzbrqu.
Cleartext password: zpasswd
Options: disableimap = 0, disablepop3 = 0, disablewebmail = 0, disablesmtpd = 0, disablesmtp = 0, disablenetdisk = 0, netdiskquota = 524288000 s
Ii. Batch Delete email accounts
1. Delete account information in the database:
Userctl. pl -- mode = del [email protected]
If the deletion is successful, the message [email protected] deleted is displayed.
2. You also need to manually delete the account email storage directory:
RF-RF/home/domains/02/13/dadi.com/46/b8/zhangs
Note:
1. first, sort out the deleted email account. For example, run the following command to query the email account name and email directory to a text file, mysql-u root-p-S/var/lib/MySQL. sock-e "use extmail; select username, homedir from mailbox;"> uname.txt
2. Based on the queried information, create a script for batch deletion of accounts and batch clearing of mail storage directories, and execute the script.
This article from the "you insist on" blog, please be sure to keep this source http://zhangzhize.blog.51cto.com/8967530/1534193