Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm having problems synchronising file permissions with rsync. I'm trying to sync my /home/bin folder with the /home/bin folder on a remote machine. The problem is that when I write a new script and make it executable with 'chmod +x' then after performing rsync, the file reverts back to being unexecutable.

If I use --perms, when I update the file permissions on the remote machine and then use rsync on the host machine, the file permissions don't get updated on the host machine and on the remote machine they get reverted back.

Is there a way to properly sync the file permissions?

UPDATE: I forgot to post the script I use:

#!/bin/bash                                                                     

rsync -e ssh -avz --recursive --progress --update --perms /home/bin username@example.com:/home                                                                              
rsync -e ssh -avz --recursive --progress --update --perms username@example.com:/home/bin /home
share|improve this question

1 Answer 1

I think your basic problem here is that rsync is not a good tool for two-way synchronization. I would recommend some solution conceptually different, otherwise you will keep clobbering yourself.

  • You could look into using Unison. It functions similar to rsync but is designed for two say synchronization.
  • Better yet, look into using a source control system like git. This is particularly useful for things like config files and your personal scripts. Each machine you use them on will have a separate checkout, and the versioning takes care of making sure that you always have the latest changes by time including merging multiple different changes rather than just having the data clobbered from any one source.
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.