here is my setup:
on my source machine i created user rsyncuser with reading and writing permissions in /source/path
on my destination machine i created user rsyncuser with reading and writing permissions in /destination/path
to use virtualmins scheduled backup feature (cron) i need to run my command as root. I do not wanna rsync directly as root (simply because no one can answer this question How to use rsync via ssh with rsa key passphrases? --- a solution INCLUDING passphrases is searched for), so I am trying to use sudo -Hu.
However there must be some error in my command/logic, 'cuz after running this command as root from the source machine:
sudo -Hu rsyncuser rsync --progress -avz /source/path/ messerliweb.ch:/destination/path/
I get lots of permission errors:
rsync: failed to modify permissions on "/destination/path/.": Permission denied (13)
rsync: recv_generator: failed to stat "/destination/path/x1.tar.gz": Permission denied (13) rsync: recv_generator: failed to stat "/destination/path/x2.tar.gz": Permission denied (13)
etc. According to http://rafaelwolf.com/?p=683 this could be due to lacking write permissions in the source folder. So I chmod'ded those. To no avail.
however what i cannot understand is that after running my command, file permissions for /destination/path are changed and my rsync user cannot cd into the directory anymore! before running the command cd and writing in this directory was possible for user rsyncuser. (i tested this multiple times)
afterwards i get:
bash: cd: /destination/path: Permission denied
why does rsync mess with my file permissions? or is it sudo -Hu? when i chmod back my file permissions for rsync on my destination machine, everything seems normal again, that is until i run my rsync command again - then writing and cd permissions are lost again.
what the heck?
seems to omit my problem. however i'd still be grateful if someone could help me understand why rsync changes file permissions?