Easy Ways To Export-Import Email Account From cPanel to Zimbra

As PIC of Excellent Zimbra VPS service. Last month, I got a new client who want to migrating their email server to Excellent Zimbra VPS. Previously, they use cpanel for the email server.

I have assign from my boss to setup their VPS from zero. Starting from installation until switching to the new server.

When i want to Export and Import their users, i following my senior guidance “Ahmad Imanudin“. From here : https://imanudin.com/2014/12/27/tips-exportimport-accountpassword-cpanel-to-zimbra/. However, it only import their usernames without the passwords. Because it use “/etc/DOMAIN/@pwcache/” to import and export their user email WHILE the complete users and password located at “/etc/DOMAIN/shadow“. You can see them at cPanel File Manager.

So, what i can do now ?? 

First, I’ve created the simple bash script again, this bash script referrals from My Senior Ahmad Imanudin, if he read my article, i wanna say “Thank you Om :-D”.

But to accomplish the script, i need the “shadow” file from cPanel, you can Login Into cPanel | File Manager. Go to the shadow directory (/etc/DOMAIN/) and download it.

cpanel2

Now, Connect and login into your Zimbra Servers via SSH and download with following guidance.

cd /srv
wget -c https://dhenandi.com/repo/export-import-acc-cpanel.zip
unzip export-import-acc-cpanel.zip
cd ex-im/

Copy your downloaded shadow file from your computer into your script directory with WinSCP or SCP (/srv/ex-im). If it’s already, In the there folder should be three files :

  • script-export-acc-cpanel.sh
  • shadow
  • readme.txt

Than, Execute the script file “script-export-acc-cpanel.sh” with root permissions.

cd /srv/ex-im
chmod +x script-export-acc-cpanel.sh
./script-export-acc-cpanel.sh

If it has finished, it will be generate (.zmp) file. The file is “createaccountzimbra.zmp“. Finally, you just to execute the ZMP script to Import the cPanel user with the following guidance :

su - zimbra
zmprov < /srv/ex-im/create-account-zimbra.zmp

and then, the user will be created at few seconds.

zmp-execute

Okay, For further information, don’t hestitate to contact me on article comments. Thank you 😉

If you Indonesian people, you can watch this video :

3 thoughts on “Easy Ways To Export-Import Email Account From cPanel to Zimbra

  1. Great tutor mas bro.. pertanyaannya, gmn caranya transfer mailboxnya?
    convert xml ga gitu jelas tutornya, cp2zim juga, shadow file ini dipake di imapsync bisakah? thx

    1. Halo Mas,
      Terima kasih, untuk transfer mailbox bisa menggunakan Imapsync. Namun kalau di cPanel harus mengetahui terlebih dahulu password masing-masing user, sementara passwordnya dienkripsi pada shadow.

      Untuk langkah migrasi mailboxnya dapat mengakali dengan cara seperti berikut :

      1. Backup Shadow
      2. Buat satu akun dengan password yang diketahui pada cPanel
      3. Edit shadow
      4. Copy Enkripsi shadow akun yg telah dibuat ke seluruh akun (Tujuannya menyamakan seluruh password user).
      5. Lakukan Imapsync
      6. Jika ingin merestore password silakan kembalikan shadown nya seperti semula

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.