When transferring cPanel accounts, there is the “Transfer tool” that comes with the tools provided as part of WHM. However, if you have already built a website on a new cPanel account, and only want to copy or migrate email accounts over from the old cPanel account, the previously mentioned tool will not help.
There is no built-in tool in cPanel to make the process easier. Thus, you’ll have to re-create the emails manually on the new cPanel account, and then move the associated data via SSH from the old cPanel to the new one.
Here are the steps to migrate cPanel email accounts, passwords, and quota from one server to another.
Step 1: Re-create the accounts
Open the new cPanel that you want to migrate to and recreate all the email accounts that you want to migrate. ( Don’t worry about passwords and quote, you can leave the defaults )
Step 2: Sync the /mail folder between old server and new server
- Open SSH connection on the old server via the command line. If the old server is using a port other than the default 22, don’t forget to append `-p xxxx
to the
`ssh` command.
ssh root@old.server.ip
Then run the following command after changing the curely bracket values accordinly.
rsync -Pvaze "ssh -p{ssh-port-for-new-server}" /home/{user}/mail/{old-domain.com}/* root@{new-server-ip}:/home/{user}/mail/{new-domain.com}/
This will get all emails moved over.
Step 3: Sync passwords and quota
You first CD into the relevant folder.
cd /home/{user}/etc/{old-domain.com}/
Run the following command to copy passwd, shadow and quota files from the old server.
rsync -Pvaze "ssh -p{ssh-port-for-new-server}" passwd shadow quota root@{new-server-ip}:/home/{user}/etc/{new-domain.com}/
Note: if the new domain is different than the old domain, you’d need to replace all instances of old domain with the new domain in `passwd` file.
That’s it, you should now be able to access email accounts on your new server with the same passwords without any issue.