cPanel to cPanel account migration

Posted at October 30, 2015 at 1:38 pm by admin

cpanel-cpanelPromises are made to be broken…This may sound depressing but it is often true when it comes to dubious web hosting providers. If you are frustrated with the restrictions and limitation of your current hosting environment, you are not alone. If your customers are often greeted with the ‘Error: The page cannot be displayed’, and you are re-learning the laws of gravity of what goes up comes down with your website, you might be thinking about a switch. So should you keep shelling dough for your incompetent web hosting or should you make a switch? Although, the answer might be a resounding ‘yes’, the complexity which comes with the migration may keep you from switching your provider. Fret not, cPanel to cPanel migrations are actually not that difficult and in fact most of the migrations goes wrong because of poor planning and not taking into account factors like disk space availability, data transfer speed, domain/account conflicts during restoration etc.

With a proper plan, any one with basic cPanel and system administration skills can do transfers like a pro! Read on to know how you can migrate from one cPanel to another.


1. Make a list of accounts that needs to be transferred (Sometimes you intend to transfer all accounts)

2. Package those accounts in a cPanel compatible form (with or without home directory – this depends on the disk space available)

3. Transfer the packages from source to destination

4. Restore packages at destination. (resolve conflicts if accounts/domain already exist at destination)

5. If you have skipped home directory at the source server while packaging accounts, sync them to the destination’s home directory.

6. Verify the success of the transfer

7. After verification, lower the TTL values of all the domains & switch till the previously set TTL reaches expiration.

Note:- We will be using the term ‘source’ to denote the server which contains the accounts that needs to be transferred and ‘destination’ to denote our target system.

1. Make a list of accounts.

If you already have a list of accounts , copy them in a file (eg:- account-list)

Scenario -1 :- You want a list of accounts owned by a reseller.

A quick and easy way to find the usernames and store them in a file.

grepresellername /etc/trueuserowners | cut -d : -f 1 >userlist

(/etc/trueuserowner have 2 fields – account and its owner, if an account doesn’t belong to any reseller, the owner will be ‘root’ by default)

Scenario -2 :- You want a list of every account hosted in this server.

cat /etc/trueuserowners | cut -d: -f1 | grep -v userowners  >userlist


cat /etc/trueuserdomains | cut -d: -f2 | >userlist

2. Package accounts

/scripts/pkgacct is a script that packages a cpanel account

/scripts/pkgacct [arguments] username destination (destination and arguments are optional, by default the package will be stored in the home directory)

Scenario 1:- You have enough disk space available at the source. You have only a few accounts to transfer. You have plenty of time.

fori in `cat userlist` ; do /scripts/pkgacct $i  /backups

This for loop will run the pkgacct script repeatedly for every account in the userlist. The packages will be stored in /backups directory

Scenario 2:- You have very limited disk space to store all the packages. You have a long list of accounts. You don’t have a lot of time.

Home directory is the largest consumer of disk space in a cPanel account. You can skip it while packaging and transfer just the remaining components.

fori in `cat userlist` ; do /scripts/pkgacct –skiphomedir $i  /backups

3. Transfer accounts

Generating SSH keypairs for passwordless authentication can avoid frequent password     prompts

To generate key pair (The public key is usually stored at /home/localuser/.ssh/ )


Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Now, we’ll copy the rsa public key to the destination. You will be prompted for the password

ssh-copy-id -i ~/.ssh/

rsync is the preferred tool used to transfer data because of its ability to resume data transfer in case of any network connectivity issues.

rsync -avzP  -e ssh  /backups [email protected]:/root/

If a non standard SSH port (eg:- 2011) is used you can wrap double quotes around ssh -p 2011

rsync -avzP -e “ssh -p 2011” /backups [email protected]:/root/

This will copy the directory /backups using rsync over ssh to the destination.

4. Restore Accounts

cd /root/backups

fori in *.gz ; do /scripts/restorepkg $i ; done

This will use a for loop iteration for restoring packages with file extension .gz, you may use the /scripts/restorepkg –force option if you have any account conflicts. Only use it if you intend to replace the existing account with the package you transferred.

5. Sync home directories

This step is for those who skipped home directory during the account packaging.

Now, I would prefer running this in the background, considering the volume of data that needs to be transferred, it may take a lot of time to sync and transfer data. There is a wonderful utility called ‘screen’ which

To start a new screen session, run screen with the following command:

$ screen -S session_name  

Then run the rsync command

rsync -avzP  -e ssh /home/  [email protected]:/home/

(Please note the trailing slash given after /home/ , this copies all files/dirs under /home to the destination directory. If you omit ‘/’ , you will be copying /home recursively to the destination and you end up having a home directory inside a home directory   — /home/home   which is not what we intend to do)

Safely exit the screen session by using the key combination CTRL + a + d

You will see a message like this:-

[detached from 27724.session_name]

Now, you can log out from your current shell session and the rsync process will be still running in the background without any interruption. You can check the progress from any location. Just login to the server via SSH again.

To list the screens running,

screen -ls

There is a screen on:

27724.session_name      (10/19/2015 11:54:47 AM)    (Detached)

1 Socket in /var/run/screen/S-username.

To reattach the screen

screen -r session_name   (or screen -r 27724.session_name)

Check the progress, once you have confirmed that the copy process is completed, you can exit the screen session using the key combination CTRL +d

[screen is terminating]

6. Verify the integrity of the data and check the disk usage of accounts at both servers to make sure we didn’t leave anything.

7. Lowering the TTL value to beat DNS propagation delay.

Migrations are followed by DNS changes. If you have access to the authoritative nameservers of your hosted domains, you will be pointing the transferred domains to a new location. This involves changing the Address (A) record and the mail exchanger(MX) records. Lowering the TTL value and waiting for the old TTL period to make the switch minimizes the problems of DNS propagation delays to a great extent. We have described this in detail in another article

(Tweaking the TTL to reduce downtime after a website migration)

If you are on a lookout for a reliable web hosting service,InterServer is a great option. Established as a premier web hosting provider located in Secaucus, New Jersey, InterServer provide unparalleled webhosting services at an affordable cost. Known for quality, reliability, with safe and secure facility, and 24/7 superior support, InterServer provides a 30 day money back guarantee on shared hosting, along with 99.5% uptime and a 100% power guarantee.

Still think migration is complex and tiresome? Please feel free to contact our support team. We offer free migration. Click here to know more about how you get migration absolutely free

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply