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
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["        <li><a href=\"http://area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"http://careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.3.15.1463\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    Ubuntu and Canonical are registered trademarks of Canonical Ltd.\r\n                </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-wa"], "copyright__copyright__copyright": ["lost again.\n\nwhat the heck?\n\nedit: adding\n\n--chmod=u=rwx,g=rwx,o=rwx\n\nseems to omit my problem. however i'd still be grateful if someone could help me understand why rsync changes file permissions?\n\nshare|improve this question\nadd comment\n\nKnow someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nBrowse other questions tagged or ask your own question."]}