You can find our user documentation at

Check out our new API beta site!

Page tree
Skip to end of metadata
Go to start of metadata

For cPanel & WHM version 56


You can use the /scripts/restorepkg script to restore a backup archive for a specified account. 


The /scripts/restorepkg script

To use the /scripts/restorepkg script, run the following command as the root user:

/scripts/restorepkg [arguments] [input] [filename]

Arguments and inputs

You can use the following arguments with the /scripts/restorepkg script:

ArgumentsDescriptionInput valuesExample

Restore the account regardless of any errors or warnings. When the system restores the account, any existing data remains intact on the server.


If the account already exists on the server, this option behaves similarly to the --skipaccount option.

--allow_resellerRestore reseller privileges.N/A--allow_reseller

The IP address to use to restore the account.


  • If an IP address is not available, the script uses the next available IP address in the IP address pool.
  • If no addresses are available, the script uses the server's shared IP address. 
  • yUse the next available IP address in the IP address pool to restore the account.

  • nUse the shared IP address to restore the account.
  • A valid IP address — Use this IP address to restore the account.


Change the restored account's username.


  • All of the account's database users will keep their current username except for the user that matches the cPanel account.
  • If you wish to change the name of a database or database user after you restore the account, use the Manage Databases (Home >> SQL Services >> Manage Databases) and Manage Database Users (Home >> SQL Services >> Manage Database Users) interfaces.
  • You cannot use this option with the --skipaccount option.

A valid cPanel username.


  • The new account name cannot already exist on the server.
  • The username must be 16 characters or fewer, and the first eight characters must be unique on the server.

Restore a package for an existing account with the same username as another existing account.


You cannot use this option with the --newuser option.


Run the restoration process with the Restricted Restore feature.

The Restricted Restore feature performs additional security checks on the backup file in order to mitigate the risk of transfers from unfamiliar sources. If a component of the backup file has an issue (for example, a compromised MySQL® grant table or a symbolic link attack), the system does not restore that portion of the backup and adds a warning to the log file.


If you do not use this argument, the script performs an unrestricted restore.


  • The Restricted Restore feature is EXPERIMENTAL. Do not consider it as an effective security control at this time. The behavior of this feature may change in a future release of cPanel & WHM. Exercise extreme caution when you use this feature.
  • If you do not trust the source of the account backup with root access to your server, use the Restricted Restore feature to protect your server.
  • To use the Restricted Restore feature to restore an account that owns PostgreSQL® databases, the target server must use PostgreSQL version 8.4 or newer .
  • The Restricted Restore feature only allows restored accounts to use the noshell or jailshell options. If the restored account uses another shell, the system will set the account to use noshell. For more information, read our VirtFS (Jailed Shell) documentation.


The backup filename 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

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

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

The script attempts to restore the account on the shared IP address with the following steps:

  1. Add the package to the AccountLocal queue.
  2. Start the restoration process.
  3. Uses the tail command to output the the log file's contents after the restoration process begins.


For example, the following command uses the unrestricted restore method to restore the cpmove-testaccount.tar.gz file to the IP address:

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