Last modified: July 28, 2020
Overview
You can use the /usr/local/cpanel/scripts/restorepkg
script to restore a cPanel account from a backup file.
You can also restore a cPanel account from a backup file in WHM’s Restore a Full Backup/cpmove File interface (WHM >> Home >> Backup >> Restore a Full Backup/cpmove File).
Do not use the skip-name-resolve
setting in your server’s MySQL® configuration. This setting will cause serious issues with server operations. If you are not an advanced MySQL administrator, expect issues with this setting. For example, you will see issues with restoring backups. This setting will also cause issues with phpMyAdmin.
Run the script
To use the /usr/local/cpanel/scripts/restorepkg
script, run the following command as the root
user:
/usr/local/cpanel/scripts/restorepkg [arguments] [input] [filename]
Arguments
You can use the following arguments with the /usr/local/cpanel/scripts/restorepkg
script:
Argument | Description | Input values | Example |
---|---|---|---|
--force |
Restore the account regardless of any errors or warnings. When the system restores the account, any existing data remains intact on the server.
Note:
If the account already exists on the server, this option operates similarly to the
--skipaccount option.
|
None. | --force |
--allow_reseller |
Restore reseller privileges. | None. | --allow_reseller |
--ip |
Restore the account to a certain IP address.
Note:
|
|
--ip=192.0.2.169 |
--newuser |
Change the restore account’s username. To change the name of a database or database user after you restore the account, use WHM’s Manage Databases interface (WHM >> Home >> SQL Services >> Manage Databases) and WHM’s Manage Database Users interface (WHM >> Home >> SQL Services >> Manage Database Users). Note:
|
A valid cPanel username.
Note:
|
--newuser=username |
--skipaccount |
Restore a package for an existing account with the same username as another existing account.
Note:
You cannot use this option with the
--newuser option.
|
None. | --skipaccount |
--restricted |
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 contains 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. Note:
If you do not use this option, the script performs an unrestricted restore.
Warning:
|
None. | --restricted |
--disable |
Disable specific modules during the account restoration process.
Warning:
We strongly recommend that only advanced users apply this option. If you incorrectly configure this option, the cPanel account may restore in a broken state.
|
A valid module name.
Note:
|
--disable=MailRouting,SSL |
Files
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-{MM.DD.YYYY}{HH-MM-SS}{USER}.tar
backup-{MM.DD.YYYY}{HH-MM-SS}{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:
- Adds the package to the
AccountLocal
queue. - Starts the restoration process.
- Uses the
tail
command to output the log file’s contents after the restoration process begins.
Example
For example, the following command uses the unrestricted restore method to restore the cpmove-testaccount.tar.gz
file to the 192.0.2.169
IP address:
/usr/local/cpanel/scripts/restorepkg --ip=192.0.2.169 cpmove-testaccount.tar.gz