Backup & Restore cPanel / WHM accounts via SSH

February 4th, 2015 | by chase
Backup & Restore cPanel / WHM accounts via SSH
Scripts & Utilities

Backup & Restore cPanel / WHM accounts via SSH

cPanel / WHM comes with a powerful backup and restore feature. Let’s learn how to use this feature via command-line / SSH.

Aside: cPanel / WHM has a wide variety of [scripts][1] that can achieve your end goal. These scripts are located in /scripts/.

Backing up singular accounts with cPanel via SSH

Backing up a singular account is easy. Simply issue the following command to backup a cPanel account named ‘drewsymo’:

/scripts/pkgacct drewsymo

This particular script, ‘pkgacct‘ generates a ‘cpmove‘ .tar.gz file. This file will be stored in the home directory of your server, i.e:


Restoring an account with cPanel via SSH

Restoring an account from a ‘cpmove’ or auto-generated cPanel backup file is just as easy as backing one up.

To restore a ‘cpmove’ file, you will firstly need to make sure that the account is terminated:

/scripts/killacct drewsymo

Now, you can initiate a complete account restoration via the ‘restorepkg’ command:

/scripts/restorepkg drewsymo

Note: the ‘cpmove’ file will need to be moved to the /home/ directory in order to initiate the above command successfully.

The latter command can be used to restore a generic auto-generated cPanel backup file (this will overwrite existing files if the account already exists and is generally not recommended)

Backing up all accounts on a cPanel Server via SSH

If you would like to backup all accounts on a cPanel / WHM server, simply issue the following command:



  1. **When I try and restore a backup via WHM it says a group with the same name already exists?
    **It’s best to use command-line when you experience this issue. Simply suffix the –force flag to the end of the restorepkg script to overcome this (restorepkg --force accountname.

Leave a Reply

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