If you’re switching servers entirely and want to bring over every single cPanel account, this guide is for you. It’s a bit more time-consuming, but still very straightforward if you follow along carefully. Let’s get started!
- Connect to the Source (Old) Server:
Use SSH from your computer or terminal to access your old server:
ssh your_username@old_server_ip
Hint: Replace your_username with your actual SSH user, and old_server_ip with the IP address of your current server.
- 2. Transfer the Backups to the New Server:
Use this command to send all the backup files to the new server:
rsync -av --progress /home/*.tar.gz root@new_server_ip:/home
Hint: Replace new_server_ip with the IP address of your destination server.
⚠️ Warning: If there are any .tar.gz files already in the /home directory in new destination server, consider removing them first. Keeping old backup files might cause confusion or lead
to restoring the wrong account. - 3. Restore All Accounts on the New Server:
SSH into your new server:
ssh your_username@new_server_ip
Go to the home directory first:
cd /home
Run the following to restore each account:
ls /home/ | awk -F'[-.]' '{print $2}' | while read a; do /scripts/killacct --user=$a /scripts/restorepkg $a done
Note: This script removes any existing accounts with the same usernames before restoring. Afterward, check each account in WHM to confirm the migration was successful.
Go to the home directory first:
cd /home
⚠️ Warning: If there are any .tar.gz files already in the /home directory, consider removing them first to avoid uploading or restoring outdated backups by mistake.
Then run this command to create backups for all existing cPanel accounts:
ls /var/cpanel/users | while read a; do /scripts/pkgacct $a done
Note: This may take quite a while depending on how many accounts you have and their sizes. Be patient and let it complete before continuing.