How to find and backup different COS users

Revision as of 11:07, 24 December 2016 by Teodor Vizirov (talk | contribs) (Created page with "=How to find and backup different COS users= {{KB|{{ZC}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}|}} {{WIP}} ==Purpose== ==Resolution== '''8. Backup COS (if different from the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to find and backup different COS users

   KB 23121        Last updated on 2016-12-24  




0.00
(0 votes)



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.

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

Verified Against: Zimbra Collaboration 8.7, 8.6, 8.0 Date Created: 24/12/2016
Article ID: https://wiki.zimbra.com/index.php?title=How_to_find_and_backup_different_COS_users Date Modified: 2016-12-24



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 »


Wiki/KB reviewed by SME1 SME2 COPY EDITOR Last edit by Teodor Vizirov
Jump to: navigation, search