How to use the command line for restoring cPanel backup?

How to use the command line for restoring cPanel backup?

One demand remains always in trend to take backup when you are not having cPanel with you. Some formats won’t allow us to take backups at a time. It might lead you to restore cPanel backup using the command line. Some steps involved in moving out the content of the website, mail account, and database. You can say it is a manual backup! But it has more steps and you will end up with errors unexpectedly.

Why do you want to restore cPanel backup using the command line? It's important to maintain the server of cPanel so, you will get a pop-up stating cPanel backup restore.
  • The server panel in destination won’t support allowing the format of cPanel backup
  • The new server won’t have a control panel
  • Unsupported servers don’t support migration
By using the command line to restore cPanel backup, you can save effort and time simultaneously. It won’t affect the server connectivity more!

Let’s do it with the help of SSH to restore the cPanel backup!

Step 1: Use the below command to transfer the backup of cPanel to the new server:

scripts/pkgacct username
scp /home/cpmove-user.tar.gz root@x.x.x.x:/home
Step 2: Once you complete the process of transferring the cPanel backup to a new server, as a root user login to the account. Check the home directory where you can find the full backup.

Step 3: File extraction will be started and then it is possible to import all details from the cPanel to the new server.

Step 4: Ensure the location of website content and homedir. Transfer the file to the root of the website document.

Step 5: Start locating the database.sql, mysql files using the below command:

mysql -u username -p databasename<database.sql
Step 6: Create the user database and allot the permission too!

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
Step 7: You can even find more files using the below path:

Step 8: In the new server, create an email account and then content from the old one to the new one.

Step 9: Finally, ensure permission and ownership. Check the details are correct or else make it the right way!

How to restore the cPanel account to the new cPanel server? Here, check the destination and source it has the same target point.

Step 1: The first step, get into the server where you need to migrate. Take the responsibility as a root user and then generate the backup using the command:

/scripts/pkgacct username
Step 2: Using the SCP command, you can send the backup to the new server:

scp /home/cpmove-user.tar.gz root@x.x.x.x:/home
Step 3: If you are done with step 2, just restore the cPanel backup with the following command:

/scripts/restorepkg username
Using this command, you can restore the database, files, and settings.

What are the ways to fix errors?

User duplication:
When you restoring the cPanel backup, you will get the problem like the below:

Cannot restore. That user already exists on this system

TO search the user server, use the command:

find / -name "username"
Here’s the output:

In the command line, do a manual process to delete entries.

Ownership and permission: Because of the ownership and permission, there are more chances to get an error on the website. Only root users have ownership to access the files. It might create more problems for you! So, by setting the ownership 644 to the file and 755 to the directory, you can sort out this problem.
First release
Last update
0.00 star(s) 0 ratings

More resources from kumkumsharma