6

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 [email protected]:/home                                                                              
rsync -e ssh -avz --recursive --progress --update --perms [email protected]:/home/bin /home

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .