I have installed a fresh version of Debian. I would like to restore some files in home
with my backuped version as well as some under etc
. The backup was created with rsnapshot.
The point which is not that clear to me is as which user should I run the restore command. Let me make an example. Assume I would like to restore my rsnapshot
file within /etc/cron.d/
. By default I see the following right permission in the fresh installed version:
station:~$ ls -l /etc/cron.d/rsnapshot
-rw-r--r-- 1 root root 472 Mar 26 2016 /etc/cron.d/rsnapshot
In this case I need to run the rsync command as root or sudo, i.e. I was doing for testing:
@thinkstation:~$ rsync /media/3985DAA24356D774/rsnapshot/station/daily.0/etc/etc/cron.d/rsnapshot /etc/cron.d/rTest
But this leads to the following permissions:
station:~$ ls -l /etc/cron.d/rTest
-rwxr-xr-x 1 root root 513 Sep 24 19:01 /etc/cron.d/rTest
and this doesn't match the system defaults one.
Another example, which is more frustrating. I was running rsync command as normal user (non root, non sudo). The files I've restored was a project which is version controlled via git. I did the restore because not all files were on github. After the restore I've seen a lot of difference because of the changed permission (which I don't understand as the files didn't involve any sudo rights and were transferred to my home
directory). So I'm not sure if I did a mistake in the past while doing the backup or if I'm doing something wrong in restoring the files. In any case I would like to know how I can resolve that issue.