Restore a single cPanel account from command line

The /scripts/restorepkg script restores a backup archive for a specified account.

How to call the script

To run the restore package script at the command line, run the following command as the root user:

/scripts/restorepkg --argument

The  backup file you want to restore must use one of the following formats:

  • cpmove-{USER}
  • cpmove-{USER}.tar
  • cpmove-{USER}.tar.gz
  • {USER}.tar
  • {USER}.tar.gz
  • backup-{BACKUP-DATE_TIME}_{USER}.tar
  • backup-{BACKUP-DATE_TIME}_{USER}.tar.gz

{USER} is the cpanel user account you want to restore.

The restore package script searches for the archive in the following locations:

  • /home
  • /home2
  • /home3
  • /root
  • /usr
  • /usr/home
  • /web

After the script locates the correct archive, it will attempt to restore the account with the shared IP address.

Available arguments

The table below lists the arguments that the /scripts/restorepkg script accepts.


Input Type
--allow_reseller This argument allows the script to restore reseller privileges. N/A
--force This argument forces the restore package script to restore the account regardless of any errors or warnings. When the system restores the account, any existing data remains intact on the server. N/A
--ip This argument specifies which IP address you will use to restore the account. string

This argument allows you to change the username for the account that you restore.


  • The new account name cannot already exist on the server.
  • The username must be 16 characters or less, and the first eight characters must be unique on the server.
--override This argument was deprecated in cPanel & WHM version 11.44. If you wish to use override scripts, create them in the /var/cpanel/perl/Whostmgr/Transfers/Systems/directory.
--skipaccount This argument allows you to restore a package for an existing account with the same username as another existing account. N/A
--skipres This argument was deprecated in cPanel & WHM version 11.44. If your legacy script uses this argument, it will perform the opposite of the --allow_reseller argument. N/A

Use the –ip argument

 The --ip argument takes one of the following options:

=y This option uses the next available IP address in the IP Address Pool to restore the account. If none are available, the script uses the shared IP address.
=n This option uses the shared IP address to restore the account.
A specified IP address
This option uses the specified IP address to restore the account. If that IP address is not available, the script uses the shared IP address.

For example, the following command will restore the cpmove-mckhost.tar.gz file to the IP address

/scripts/restorepkg--ip= cpmove-mckhost.tar.gz

The scrip will generate a log file you will be able to “watch” at any time to check the progress of the restore process and identify any possible issue.

About the Author

Leave a Reply

%d bloggers like this: