Steps to create users using mysql details where accounts accidently removed from the LDAP

Create users using MySQL details where accounts accidently removed from the LDAP


   KB 23362        Last updated on 2018-08-13  




0.00
(0 votes)


Problem

1st Scenario: LDAP got corrupt and we do not have latest LDAP backup.

OR

2nd Scenario: Somehow users removed from LDAP and we still have account entries in MySQL DB.

Solution

In this situation, we have to restore LDAP with available backup and then we will extract accounts' entry from MySQL DB. From MySQL, we have to extract mailbox id, account id, and email-addresses of missing accounts.

After collecting all missing or removed account's details we will create the account with the Zimbra id.


This is the complete description of activity which we have to perform

1). Missing accounts' list extract from MySQL database:-

  • Using the following command we can extract accounts' list from a particular domain.
mysql -e 'select id, account_id, comment from zimbra.mailbox where comment regexp "@mytestdomain.com";' 
+-----+--------------------------------------+----------------------------------+
| id  | account_id                           | comment                          |
+-----+--------------------------------------+----------------------------------+
| 771 | ee4b049a-3d99-4908-b2b8-5cb069350ec8 | it@mytestdomain.com              |
| 773 | c01cfd8d-69d9-44c8-8234-99371fd19205 | testadmin@mytestdomain.com       |
| 774 | 1e4645e8-2e37-48be-ac71-34bd144850f6 | test1pop@mytestdomain.com        |
| 775 | d2a8b102-76df-4b99-a06a-ca64be3eae5d | testuser@mytestdomain.com        |
+-----+--------------------------------------+----------------------------------+
  • If we have only one domain then we can run MySQL query without where clause.
mysql -e 'select id, account_id, comment from zimbra.mailbox;'


2). Now we have to re-create accounts on LDAP with the same zimbraId:-

zmprov ca it@mytestdomain.com test1234 zimbraId 'ee4b049a-3d99-4908-b2b8-5cb069350ec8'
zmprov ca testadmin@mytestdomain.com test1234 zimbraId 'c01cfd8d-69d9-44c8-8234-99371fd19205'
zmprov ca test1pop@mytestdomain.com test1234 zimbraId '1e4645e8-2e37-48be-ac71-34bd144850f6'
zmprov ca testuser@mytestdomain.com test1234 zimbraId 'd2a8b102-76df-4b99-a06a-ca64be3eae5d' 


3). After the above steps we have to check and verify the mailbox id, quota details, folder and mail counts of created accounts:-

zmprov gmi it@mytestdomain.com
mailboxId: 771
quotaUsed: 5668 
zmmailbox -z -m it@mytestdomain.com gaf


Verified Against: ZCS 8.8, 8.7, 8.6, 8.5 Date Created: 2018-08-13
Article ID: https://wiki.zimbra.com/index.php?title=Steps_to_create_users_using_mysql_details_where_accounts_accidently_removed_from_the_LDAP Date Modified: 2018-08-13



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search