In Progress CPANEL-35678 - New files won't be removed after home directory restoration

maodoanminh

Registered
Jan 21, 2021
2
0
1
vIETNAM
cPanel Access Level
Website Owner
Hi everyone,

I'm testing the backup tool in cPanel.

A user uploaded a file, and then I used Backup Wizard to restore the home directory to a day before the upload, using a home directory backup file, but the new file is still there.

Is the backup and restore tool supposed to have removed the new file?

Thank you very much.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,036
379
243
cPanel Access Level
Root Administrator
Hey there! This is the expected behavior for the cPanel >> Backup Wizard tool at this time. Since this tool gives users the option to perform their own restores, we decided not to remove files that didn't exist in the backup. If you need to perform a restore due to a security issue, such as the site being hacked, it is best to have the server admin terminate the account and restore the entire account from a backup, or recreate the account and have the end-user perform the restore through the cPanel interface, as that will ensure no stray files are left behind.
 

maodoanminh

Registered
Jan 21, 2021
2
0
1
vIETNAM
cPanel Access Level
Website Owner
Hey there! This is the expected behavior for the cPanel >> Backup Wizard tool at this time. Since this tool gives users the option to perform their own restores, we decided not to remove files that didn't exist in the backup. If you need to perform a restore due to a security issue, such as the site being hacked, it is best to have the server admin terminate the account and restore the entire account from a backup, or recreate the account and have the end-user perform the restore through the cPanel interface, as that will ensure no stray files are left behind.
Thank you for the prompt reply. How about changes to a file? For example, if I make a wrong change to config.php and then restore the whole home directory to its previous state, will the previous file be restored? Thank you.
 

Spirogg

Well-Known Member
Feb 21, 2018
105
22
18
chicago
cPanel Access Level
Root Administrator
Hey there! This is the expected behavior for the cPanel >> Backup Wizard tool at this time. Since this tool gives users the option to perform their own restores, we decided not to remove files that didn't exist in the backup. If you need to perform a restore due to a security issue, such as the site being hacked, it is best to have the server admin terminate the account and restore the entire account from a backup, or recreate the account and have the end-user perform the restore through the cPanel interface, as that will ensure no stray files are left behind.
hello @maodoanminh @cPRex

I used the backup restore in WHM/ I setup the backup process to take 5 backups total so I have 5 days of backup and while testing some configurations on a website that I made some errors on then restored my site from one if the backups the day before and my changes that were creating an error were gone. it was back to normal again. so the changes I had made that created the error in the files I changes were not there any longer. so maybe that would be the best way to do this. just incase you need to restore someones directory and database emails etc..




first setup backups in Home > backup > backup configuration

and setup your options there ( if you did not set that up already)

as I said about I have everyday backed up and limit is 5 backups.


so I have 5 days of backups to restore from.


Then go to your WHM Home > backup > Backup restoration
then you will see all the accounts on your server, select the account you want to restore and select the day you want to restore to, before the file was uploaded and it should not be there when you restore there backup.

this is what I have done in the past and works for me

hope this helps you in some sort of way


Spiro
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,036
379
243
cPanel Access Level
Root Administrator
@Spirogg - he's specifically working with the cPanel-side tools, which behave a bit differently than the WHM backups.

@maodoanminh - currently yes, that file would be overwritten, but I believe that behavior is a bit odd. It doesn't make sense to me that a file that doesn't exist would be kept in place, such as something created by a compromised script, but files that *do* exist will get overwritten with the version in the backup.

I've opened case CPANEL-35678 to have our developers investigate the behavior. I'm not saying the current behavior is right or wrong, but I'd just like to confirm if that is what expected to happen. Once I have more details I'll be sure to post an update here.