How to Restore cPanel Backups via SSH?

You can restore cPanel backups with any of the below mentioned ways.

#1. Restore Backup From .sh File

  • First of all, log into your SSH as a root.
  • Create a new .sh file using the below command.
[root@test ~]# touch testbackup.sh
  • Open the newly created file using the below command.
[root@test ~]# vi testbackup.sh
  • Paste the below script in the testbackup.sh file.
#!/bin/bash

LBLUE='\033[1;34m'
LCYAN='\033[1;36m'
LGREEN='\033[1;32m'
LPURP='\033[1;35m'
LRED='\033[1;31m'
NC='\033[0m'

for files in /home/username/public_html/backup/*; do
 if [ -f "$files" ]
 then
 /usr/local/cpanel/scripts/restorepkg "$files"
 printf "${LGREEN} $files Done \n${NC}"
 else
 printf "${LRED} $files Not Done \n${NC}"
 fi
done
  • Do not forget to change the path with the path where the file is present that needs to be restored.
  • Once done with the modification, press the ESC button on your keyboard and then type :wq! to Save and Close the file.
  • Use the below command to hit the newly edited file.
[root@test ~]# ./testbackup.sh

#2. Restore Backup Via Linux Commands

Other than restoring the backups from the Shell script, you can also use simple Linux commands to perform the same task.

  • You can easily backup your existing cPanel by following the below command:
[root@test ~]# /scripts/pkgacct username

Change the username with the cPanel username you want to backup and package it into a single file.

  • Now, that you already have the backup file transferred to the new server, you can easily restore it by following the below command:
[root@test ~]# /scripts/restorepkg username
  • If the backup file is located anywhere else, transfer it to your server, and follow the below command:
[root@test ~]# /scripts/restorepkg /root/user/backup/file.tar.gz

Once you hit the above command, the restoration process will begin and you can view the output as it'll restore all the cPanel accounts present in your tar.gz file.
You can check the blog to know in detail procedure for restoring cPanel backups via SSH.

  • bulk cpanel restore from ssh root, Backup, public_html, restore backup using putty, Restore backup from .sh file, restorepkd command use, use of .sh file, restore cpanel backup using linux command, restore backup using shell script, sh script to restore bulk cpanel backups, pkgacct command, SSH method to restore bulk cpanel backups, restore cPanel bulk backups from putty, how to restore cPanel backup in ssh, restore cpanel from ssh
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What are some Basic SSH commands?

List of some basic SSH commands are: ls – This command is used to list all files and...

How to connect to SSH?

Putty is an open-source SSH client used to connect to a remote server. This article describes how...

20 Basic Linux Commands and their Uses.

Following are the top 20 basic Linux Commands with Live Examples that would definitely help you...

How to Block/Unblock IPs from SSH?

You can easily block or unblock IPs  from SSH. #1. Block An IP Address from SSH First of all,...

How to install CpCleaner in cPanel through SSH?

CpCleaner is a cPanel plugin created to give cPanel users the option to clean junk files that...