How to find and backup different COS users
How to find and backup different COS users
Purpose
Resolution
8. Backup COS (if different from the "source" server).
If you have only the default COS on the "client", but its with different settings from the COS on the "source" server, you have to rename it and then import it under different name.
- Download JXplorer from http://jxplorer.org/downloads/users.html
Create new entry as follows:
Host: "client" server IP Port 389 ; Protocol v3 Base DN: cn=zimbra
Authentication:
Level: User + Password User DN: cn=config Password is the output from: zmlocalconfig -s ldap_root_password
Click OK.
- From the left Tree View, expand cos.
- Select the COS that you want to export&move to the "source" server.
- From the File menu line above, click on LDIF > Export Subtree > Save on the local disk.
- Do that with all COS you want to move.
(leave the JXplorer open for the import)
9. Create files for each COS, and their respective user members.
mkdir /migration/cos_users
#!/bin/bash # The result is a file/s for each COS, and the users within this specific COS # Note: If there are no custom created COS, there will be no users listed in the default and default_external files. That # means all users are in the "default" COS. # Since the default and the default_external files will contain no users, their respective files are deleted at # the end. Zimbra only detect users that are not in the default COS. Thus, every non detected user is in the default COS. source ~/bin/zmshutil; zmsetvars for i in `zmprov gac` do id=`zmprov gc $i | grep -e "\bzimbraId\b"|cut -d " " -f 2` ldapsearch -x -H $ldap_master_url -D $zimbra_ldap_userdn -w $zimbra_ldap_password| grep -e $id -e "dn: uid=" -e mail:|grep -v Email| grep -e zimbraCOSId -B1 -A1|grep mail|awk '{print $2}' > /migration/cos_users/$i /bin/rm -rf /migration/cos_users/default* done
1. Restore COS.
To import to the "source" server:
- Create new entry in the JXplorer as in the import, but this time specify the "source" server IP.
- Click on the "cos"
- LDIF > Import File > Select File > Import
Do that with all COS you want to import.
6. Add the migrated users from the "client" to their respective COS on the "source".
#!/bin/bash # The script first list the exported cos names, then iterate through all members within this cos and finally assigns the # user to the COS. for cos in `/bin/ls -1 /migration/cos_users | tr " " "\n"` do for i in `cat /migration/cos_users/$cos` do zmprov sac $i $cos done done
Additional Content