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
cd /srv/ unzip "@pwcache.zip" mv "@pwcache" "pwcache"
– Make script for looping users, get password and create account
vi create-acc.sh
Fill with the following line
#!/bin/sh # Clear screen clear rm create-account-zimbra.zmp touch create-account-zimbra.zmp echo "Looping for all users" for ACCOUNT in /srv/pwcache/* do PASS=`cat "$ACCOUNT" | grep passwd: | cut -d ':' -f2` ACC=`echo $ACCOUNT | cut -d "/" -f4` echo "Retrieve password account $ACC" echo "ca $ACC@imanudin.net PasswordTemp" >> create-account-zimbra.zmp echo "ma $ACC@imanudin.net userPassword '{crypt}$PASS'" >> create-account-zimbra.zmp done echo "Complete"
Note : Don’t forget to change domain imanudin.net with your domain
– Save, give execute access and run the script
chmod +x create-acc.sh 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
su - zimbra 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 😀
Ajiiiib Mas beroooo…
Wow .. your boss sometimes gives you real Work .
GOOD
kalau kebalikannya gimana pak?
saya ingin pindahin mail accont zimbra saya ke cpanel, kira2 langkahnya bagaimana ya?
Jika kebalikannya saya belum pernah coba mas
Excellent solution for account migration, thank you for sharing, How did you migrate imap data in this case? without knowing the passwords .
Hello,
There some scenario for migrating email
– All email should be downloaded via POP3 by users before migrate to the new server
– Perform backup all data on cPanel and restore on another WHM/cPanel (you should have another WHM/cPanel). Reset all password and migrate use imapsync
– Reset all password directly and migrate use imapsync
Mas kalau mailbox nya pakai imapsync tanpa harus tahu passwordnya ada tutorialnya?
Hi mas,
Saat ini belum ada mas
mas , klo backup plus mailboxnya gmna ya
Hi mas,
Untuk backup, bisa didownload terlebih dahulu semua emailnya via POP dari email klien 😀
This worked like a charm. Thank you very much for saving me and two support engineers from 4 hour of headache! 😀
Interestingly, official Zimbra Wiki refers to rather cumbersome way of doing it through firebug.
Hi Flanger,
Thanks ;). HTH
Hi iman,
I’ve tried your tutorial but when I’m trying to log on using the same password as the cpanel isn’t working. I’m using Zimbra version 8.7.2 Collaboration.
And after this command
zmprov < /srv/create-account-zimbra.zmp
The last output is
usage: modifyAccount(ma) {name@domain|id} [attr1 value1 [attr2 value2…]]
Could you please help ?
Thanks anyway.
Hello Guilherme,
Could you share the contents of create-account-zimbra.zmp?
Hello Iman,
I’ve already solved. Thanks a lot. Now I have another problem if you or anyone here could help me I appreciate it.
I’m creating another script that will first sync (using imapsync) the content of the mail accounts from Cpanel server to Zimbra Server and then put the old password of the users. I’ve tested and it’s working pretty fine.
My problem is I need frist save the shadow file, reset all mail accounts passwords to use imapsync (it doesn’t accept crypt passwords), sync all data of the mail and then use your script just this part
echo “ma $ACC@imanudin.net userPassword ‘{crypt}$PASS'”
to put back the original passwords of the users. As I said before it works.
Questions:
1) Does any way to use imapsync or another to sync all data of users e-mail accounts from Cpanel server to Zimbra Server without reset users’ password ?
2) How to rollback users passwords in a Cpanel Server? It just replace the new shadow file with the older after reset all passwords or is there another way ?
Sorry for the long text.
Thanks.
Hi,
You can copy shadow file as backup and reset all password of users. When you done sync, you can replace shadow file with the backup
Anyway to import emails (inbox, sent, trash, etc)?
Hello Eric,
You can reset password user on cPanel and sync use Imapsync
Thanks I will try it.
Well, it is painful to transfer 1000s of account by changing each email password.
Hi Eric,
You can backup shadow password on cPanel and modify shadow password with password do you want. Shadow password can modify as plain text
Thanks
You are the best!!!
Thank you for each post in this blog.
Hello.
I did this process, and export account was very easy, so Now I want to know if you know some kind to import data from cpanel mails from exported account to zimbra, I try to use imapsync but customer doesn’t sent me password users, so I need to know if I can to use imapsync with encripted password previously exported file?
Hello Mario,
You can backup all data from existing cPanel and restore the backup to another cPanel. On another cPanel, you can reset password all user and you can imapsync their mailbox ;).
That’s what i do to imapsync mailbox
Hello Iman
Thanks for your response, I will did that in the next time, in this case I compress all mail folder from Cpanel and copy folder in Zimbra server, then I did a script to import all data from cur and new folder with addMessage option in each mailbox in Zimbra and in one hour I finished migrate all data.
Thanks!!
Hello Mario,
Wow, glad to hear that. Thanks for share
H Iman
all steps worked for me except the last command, i got the below error, how to solve this?
zimbra@mail:~$ zmprov < /srv/create-account-zimbra.zmp
[4] 7325
-su: lt: command not found
-su: /srv/create-account-zimbra.zmp: Permission denied
Hi
zmprov < /srv/create-account-zimbra.zmp instead in run
zmprov < /srv/create-account-zimbra.zmp
now accounts got created, my admin console id is admin@mydomain.com, now saying that authentication denied to login, how to solve this?
Hi Prabhu,
Pls, in need of urgent help!! My zimbra mail server HDD crashed, and I had to do a data recovery on the HDD from a data recovery company. All the folders and files were successfully recovered out, and now I’m seting up a fresh zimbra platform higher than earlier version. How best can I migrate (import) this recovered data into the new zimbra mail platform. Pls help urgently plsss anybody
Hi Semeg,
You should use same version of your Zimbra if you want to recover your data.
Hi Iman, The issue i’m having is that I installed ubuntu 12.04 LTS OS on the crashed Zimbra 8.0.2, but Ubuntu 12.04 has no more support and some dependencies are not available on their repository. (Zimbra 8.0.2 can only be used with Ubuntu 10 & 12.04). How do I go about this please?
Expecting your reply. Thanks
Dear all, needing help Please on the above
Hi Semeg,
You can use CentOS 6 for recovery and restore. You can
– Install CentOS 6 and install Zimbra 8.0.2
– All configuration should similar with crash server (especially hostname)
hi
superb work:!! fro zimbra 8.8.15 p6
but in last you have to use :
zmprov /srv/create-account-zimbra.zmp
is there any tutorial ::
mail migration from Cpanel to Zimbra ?