Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

edit: adding

--chmod=u=rwx,g=rwx,o=rwx

seems to omit my problem. however i'd still be grateful if someone could help me understand why rsync changes file permissions?

share|improve this question
    
Where is the destination path? A remote server? A mounted NTFS partition? –  Braiam Sep 9 '13 at 14:14
    
I've had the same situation for normal rsync. I also use rsync with the '--backup' option and have the same issue on that path, the workaround with chmod seems not to apply for that backup path... Annoying. At least in the end the data is backed up but the false positives in error messages make me not look anymore to errors... and hide potential important issues –  jdehaan Jan 17 at 7:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.