Transfer accounts between cPanel servers from shell

By in articles, bash, cPanel, Server Admin, Tutorials on September 25, 2010

As a web host administrator I always have to move accounts between my cPanel servers.
The WHM has got an interface to transfer accounts between servers but most of the time it does not work for me.I get network issues, sometimes timeout issues and many other errors.
So heres a short roundup about “How to transfer accounts between cPanel servers”.
I will be using the cPanel scripts which it uses for packaging and restoring accounts.

Here’s how I do it:
If you already know the username then you can skip this step.This step is to find the username associated with a domain name:

$ cat /etc/userdomain | grep <the_domain_name>

Once you get the username use the cPanel script to package that account:

$ /scripts/pkgacct <username>

The packaged file is saved at /home.

Once packaging is done, its now time to transfer the packager file over to the destination server.I use “scp” for this:

$ scp /home/<filename> root@destinationServer:/home/<filename>

When the transfer is complete, ssh into the other server and run the cPanel script to restore the packaged account from file:

$ /scripts/restorepkg --force /home/<filename>

If you need to give a dedicate IP to the account :

$ /scripts/restorepkg --force --ip=y /home/<filename>

Thats it you just transferred the account to a new server.
Now you can terminate the account from the previous server:

$ /script/killacct <username>

That’ it. Obviously you have to correct the DNS for the domain name for the site.

Tags: , , , ,

2 Responses to “Transfer accounts between cPanel servers from shell”

  1. Monalisa Smith says:

    Nice information…..thanks.
    http://www.hosts101.com/

Leave a Reply