HestiaCP Restore Backup via SSH

Last updated on July 27th, 2022 at 06:17 am.

If you need a step-by-step guide, watch the video above to learn how to import Hestia CP backup via SSH. Or, read the post below.

If you are on Windows, download Git because we will use Git Bash to finish this task. On Linux and mac you can use Terminal.

Step 1: Back up and download the backup from your Hestia dashboard.

Go to the HestiaCP dashboard and create a new backup for the user you want to back up.

Then download the backup to your local PC. 

Watch  this short video if you don’t know how to backup and download your backup via the HestiaCP dashboard

Step 2 Change permission for the /backup folder

This is done on the remote server. You will be uploading the backup file to /backup .

Secure Copy (scp), will fail due to permission denied error if you do not do this.

You need to give read write execute permission (777) on the backup folder. This is only temporary. As soon as you upload the file successfully you will change permissions back to 755.

So, log into your server and do the following:

sudo  chmod 777  /backup

After uploading the backup you will change backup folder permissions back to 755.

Step 3:  Upload it to your server via scp

This part is done on your PC . Do not do this in the Git Bash  or Terminal window where you are logged in on your server.

If you are on Windows, ensure you have installed Git (Which comes with Git Bash). The following assumes that you have followed my Ubuntu 22.04 Server setup which uses an SSH key to log in and changes the SSH port of your server.

The scp command is used as follows to copy from a local PC to a remote server.

scp <options> <source> <destination>

On HestiaCP the destination path should be [email protected]:/backup . This is where Hestia Control Panel backups are stored.

The server user in this case is any user with SSH login access. It could be the root user or the Ubuntu sudo user you set up.

Example 1:  If you are not using an ssh key and use the default SSH port:

If you do not use SSH key authentication for your Ubuntu/ Debian server, use scp like this:

scp  ~/folder1/sampl3.2022-06-17_16-20-01.tar  [email protected]:/backup

Then enter your password and the copying will begin.

Hint: On Windows? Put the downloaded file in a folder within your Windows user’s home directory. Home directory link is usually something like , C:\Users\username\.  The C:\Users\username\ can simply be replaced by a tilde (~) in Git bash, just as it would be on Mac and Linux. 

Example 2: If you use SSH Key Authentication and has changed your Ubuntu SSH port

If you have set up SSH Key authentication, disabled password authentication and changed the SSH port as shown in this Ubuntu 22.04 server setup, you can still use SCP.

You need to add the port and the id of your SSH key as follows:

scp -P 7059  -i  ~/.ssh/Tutorials/ubu2204/ubu22keys   ~/folder1/sampl3.2022-06-17_16-20-01.tar  [email protected]:/backup

The port is signaled with a capital P (-P).

The -i signals the identity of your private key. 

If the login key and user is correct, the copying will begin.

Step 4 :  Change permission for the /backup folder again

On your server, change the Hestia backup folder permissions back to 755.

sudo  chmod 755  /backup

Step 5 : Restore the backup via SSH.

On the server where you are importing backup, restore the backup for your Hestia panel user.

sudo /usr/local/hestia/bin/v-restore-user  sampl3  sampl3.2022-06-17_16-20-01.tar

If the user, sample3 does not exist, Hestia will create it.. The user and the backup file must have the same name as shown in the command above. 

You can create a new user. Let’s say you want the import to be done for a new user named usern3w. Then you will have to rename the backup file to usern3w.2022-06-17_16-20-01.tar.

Rename the backup file:

sudo  mv  /backup/sampl3.2022-06-17_16-20-01.tar   /backup/usern3w.2022-06-17_16-20-01.tar

Then restore the backup:

sudo /usr/local/hestia/bin/v-restore-user  usern3w  usern3w.2022-06-17_16-20-01.tar

Step 6 : Remove the backup file.

This is optional. If you anticipate you might need it in future then let the backup file be.

rm  -f   /backup/sampl3.2022-06-17_16-20-01.tar

This is how to restore HestiaCP Backup via SSH. If you go to your dashboard you will see that your HestiaCP import was successful. If you still have any questions, comment below.

Access for the new user

You can reset the HestiaCP user’s password as follows:

sudo  /usr/local/hestia/bin/v-change-user-password  sampl3  password2020

If the imported user had 2FA enabled, you can disable 2FA via SSH as follows:

sudo  /usr/local/hestia/bin/v-delete-user-2fa  sampl3

Recommended VPS Providers

Find out the VPS providers I recommend.

Sign up below to download a Free Getresponse PDF Tutorial.

Cheapest dedicated Server provider. View prices.
The most reliable VPS cloud provider - Vultr Cloud

Comment Here