Cpanel – migrate all email accounts to new cPanel server with existing passwords. No password change

For migration of user accounts between cPanel servers, there is a superb “Transfer tool” which is provided and is part of Cpanel. With it, you can simply migrate all data from one server to another. But what about when you have the same accounts on both servers and you don’t want to overwrite data on a new server? I had one account for which the only email was necessary to transfer. This is not something transfer tool can do because I didn’t want to overwrite account.

If you have many email accounts and you don’t know passwords for them, it is realy pain inĀ  the ass to change all passwords and make transfer via imapsync. But luckily, you can simly copy all email accounts from one Cpanel server to another by copy user’s “passwd” and “shadow” file.

Here is how you can migrate all email accounts from one server to another without changing username/password. All passwords will be transferred.

First, make sure that domains for which you want to transfer email is already on new server. Then you’ll have to copy passwd file where all users are saved and then shadow file, where all passwords for those email accounts are saved. Those files can be found in /home/username/etc/ directory. If domain directory does not exist, you can simply copy directory to new server:

[root@cpanel]# rsync -av /home/username/etc/mydomain.com root@cpanel2.server.com:/home/username/etc/

You should now see all email accounts on new cpanel server. Now you have to transfer email data also. This is under /home/username/mail/mydomain.com/.

[root@cpanel]# rsync -av /home/username/mail/mydomain.com/ root@cpanel2.server.com:/home/username/mail/mydomain.com/

Now all email is transferred on new server. It is good practice to fix permissions of all email data. Cpanel provides the script for this. Run mailperm script on new server.

[root@cpanel2]# /scripts/mailperm username

You should have now have all emails on new server, with all data and old passwords.

3 Comments

Got Something To Say:

Your email address will not be published. Required fields are marked *

*

I accept the Privacy Policy

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

Thanks for the tutorial,
But in my case, i have a dedicated server where i have root access

from there i wanted to copy the complete mail data to another Shared Server but as an addon domain emails ..

Any help in this regards (destination cPanel also give Terminal access

© 2024 geegkytuts.net
Hosted by SIEL


About author