In the dynamic realm of system administration, need for smooth transitions between email platforms is not just a possibility. It’s a necessity. If We’re a sysadmin looking cPanel Export Email User Account to Zimbra, this is the right place. In this guide, we’ll navigate through the steps with finesse, ensuring migration is as seamless as possible.
Landscape – cPanel and Zimbra
Begin by acknowledging the robustness of cPanel. As a system administrator, We’re well aware of its user-friendly interface and comprehensive features. However, the decision to migrate often stems from a desire for enhanced functionalities, and that’s where Zimbra steps in.
Embracing Zimbra’s Versatility:
Zimbra, with its collaborative tools and open-source nature, offers a more integrated and collaborative experience. Recognize the potential of Zimbra to streamline communication and boost productivity within our organization.
Navigating the Export from cPanel:
- Log into cPanel and locate the email accounts you wish to export.
- navigate to
/home/(user_name)/etc/your_domain
.
- Compress folder @pwcache on the right pane with highlight folder and right click
- Download file @pwcache.zip
- Copy file to Zimbra Server with SCP, WinSCP or other. Put on folder /opt.
Import Account and Password Email cPanel to Zimbra
Login to Zimbra server, go to folder /opt/
and unzip the file.
cd /opt/
unzip @pwcache.zip
mv @pwcache pwcache
what is in the pwcache folder?
If we are curious about what is in the pwcache folder, we can see it with "ls -al"
then "vim"
. Example:
[root@mail pwcache]# cd /opt/pwcache/
[root@mail pwcache]# ls -al
total 416
drwxr-x--- 2 root root 4096 Oct 6 09:05 .
drwxr-xr-x. 5 root root 4096 Dec 5 11:07 ..
-rw-r----- 1 root root 198 Oct 6 09:32 accounting
-rw-r----- 1 root root 202 Aug 21 14:18 accounting.cbg
[root@mail pwcache]# cat accounting
passwd:$6$LGJ5Z8/Pc7MAqd/J$YVnfghjkjhgfdfgnUZlDJIZoRWo7BdtnkEQs4LqqC4p3c87sRb9s1avpmGUzNfc8oWJ1
quota:1073741824
homedir:/home/our-account-cpanel/mail/our-domain.com/accounting
lastchanged:19590
The idea is, create script for select and get passwd from available user information. So we can create user and password same as cPanel mail account.
Create Script for Import
- Create script for looping users, get password and create account.
vim create-acc.sh
Fill with this code.
#!/bin/sh
# Clear screen
clear
rm create-account-zimbra.zmp
touch create-account-zimbra.zmp
echo "Looping for All Users"
for ACCOUNT in /opt/pwcache/*
do
PASS=`cat "$ACCOUNT" | grep passwd: | cut -d ':' -f2`
ACC=`echo $ACCOUNT | cut -d "/" -f4`
echo "Retrieve password account $ACC"
echo "ca $ACC@our-domain.com PasswordTemp" >> create-account-zimbra.zmp
echo "ma $ACC@our-domain.com userPassword '{crypt}$PASS'" >> create-account-zimbra.zmp
done
echo "Complete"
Note : Change domain our-domain.com with your domain!
- Give permission execute. And then execute.
chmod +x create-acc.sh
sh create-acc.sh
After finish, script will create file with name create-account-zimbra.zmp who contain with command for create account and modify password.
Run Script create Account Zimbra
As zimbra user, run the script from results of get user and password script cPanel above.
su - zimbra
zmprov < /opt/create-account-zimbra.zmp
Post-Migration Testing and Validation
After the migration, don’t forget the crucial step of testing. Ensure that emails are flowing seamlessly, and all features are functioning as expected. make sure sers can log in with their own password. cPanel Export Email User Account to Zimbra might seem like a daunting task, but with careful planning and the right tools, it can be a smooth and rewarding experience.
Credit Source: Imanudin.