Powered by Blogger.

Tips Export/Import Account+Password cPanel to Zimbra

Yesterday, i have a task from my boss to migrate email server from cPanel shared hosting to Zimbra Mail Server. For migrate all account from cPanel, i am usually create manually existing account on cPanel and reset password for all user if will migrate to Zimbra. If be able, my boss want every password of users not get change and migrating email seamlessly.

What i do for export account+password on cPanel and import on Zimbra is like following :
# Export Account+Password cPanel
– Login to cPanel. Select menu Files | File Manager
– Go to /etc/yourdomain-folder
– Right click at folder @pwcache on the right pane and select compress
– Download file @pwcache.zip
– Copy the file to Zimbra server with SCP, WinSCP or something else and placed on folder /srv/
Import Account+Password cPanel to Zimbra
– Login to your Zimbra server, go to folder /srv/ and unzip the file
1.cd /srv/
2.unzip "@pwcache.zip"
3.mv "@pwcache" "pwcache"
– Make script for looping users, get password and create account
1.vi create-acc.sh
Fill with the following line
01.#!/bin/sh
02. 
03.# Clear screen
04.clear
05. 
06.rm create-account-zimbra.zmp
07.touch create-account-zimbra.zmp
08.echo "Looping for all users"
09. 
10.for ACCOUNT in /srv/pwcache/*
11.do
12.PASS=`cat "$ACCOUNT" grep passwd: | cut -d ':' -f2`
13.ACC=`echo $ACCOUNT | cut -d "/" -f4`
14. 
15.echo "Retrieve password account $ACC"
16.echo "ca $ACC@imanudin.net PasswordTemp" >> create-account-zimbra.zmp
17.echo "ma $ACC@imanudin.net userPassword '{crypt}$PASS'">> create-account-zimbra.zmp
18. 
19.done
20.echo "Complete"
Note : Don’t forget to change domain imanudin.net with your domain
– Save, give execute access and run the script
1.chmod +x create-acc.sh
2.sh create-acc.sh
– The results of the script is file create-account-zimbra.zmp who contain with command for create account and modify password
– Run the result of script on Zimbra
1.su - zimbra
2.zmprov < /srv/create-account-zimbra.zmp
– Please check account via Zimbra admin and testing login to webmail with password previously on cPanel
Good luck and hopefully useful 😀
    Blogger Comment
    Facebook Comment