Debian – How to restore permissions with BackInTime/rsync

backintimedebianpermissionsrestorersync

Apparently BackInTime, which uses rsync, doesn't just restore permissions when restoring files but also saves them separately to the data. Is it possible to restore permissions of specific directories / files only? I don't want to restore any files but only restore the permissions files had earlier.

Is this possible somehow?
If not the best way would probably creating a list changes of permissions by comparing files to the backup and doing it manually (related question).

I'm using Debian 9.1 with KDE.

Best Answer

GNU chmod can take a reference file:

--reference=RFILE
use RFILE's mode instead of MODE values

If the folder structure of your back remains the same, you could do something like:

cd /path/to/backup
find . -exec chmod --reference={} --changes /source/of/{} \;

/source/of is the path from which the backup was done.

Now you can use find's tests to only operate on the desired files/directories.

Since you say it uses rsync, I think the directory structure should be retained, and it should be possible for you to mount the remote system locally using SSHFS, etc., so in principle this should work.

Related Question