Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need a good way to sync a directory between my OSX 10.6 laptop and my Ubuntu Desktop. Dropbox would obviously be a great choice, however the directory I need to sync is owned by root on both machines and fixing the permissions would screw up the situation I have going. I was considering just writing my own script using rsync (which would indeed be fun) but I'm wondering if perhaps there is something a bit more robust out there. I've heard of Unison, but I don't know very much about it. Would that be a good option for me, or can you come up with something better? Thanks!

share|improve this question
1  
RSYNC is very robust, but all by hand. I believe some wrote a GUI app that can manipulate rsync on OSX, google around you'll find it. –  SpacemanSpiff Jul 11 '11 at 3:36
add comment

2 Answers

two easy answers, (and the same you've already mentioned):

  1. Unison if you want something that 'just works'. Has a nice GUI and you can easily define a task there and call from command line, a script, cron, whatever. I use it to synchronize both my laptop and my wife's with our respective user directories on the desktop. It's really that easy.

  2. rsync if you want to control (almost) every aspect. There's lots of arguments that let you respect, modify or clobber permissions, onwers by number or by name, etc. In fact, there's seldom any need for a complete script; usually you only have to find (by trial and error) the best combination of arguments.

share|improve this answer
add comment

Unison is a nice solution if you need to do two-way synchronization, and want to be able to resolve conflicts manually. It keeps a note of what was synchronized last time, so it knows if a file has been changed at both ends.

If you want a purely background solution that happens automatically (eg from cron) and has a pure one-way synchronization, rsync may be better. Unison keeps comprehensive metadata around (in ~/.unison) which you don't need if you're doing one-way synchronization.

The fact that both ends are owned by root complicates things considerably, whether you're using rsync or Unison. You'll need to use sudo on the destination to get write access, but you don't want to be ssh-ing into the source as root. Provided the source is all world-readable, you may be able to do this by running sudo rsync on the destination and giving an explicit non-root user for the source (user@host:...). Note that you can use public-key authentication and set up the authorized_keys file so that only rsync can be used with that key.

In one situation I have solved this by exporting the whole directory with the rsync daemon, thus allowing anonymous access. This circumvents permissions, obviously, but my real need was to produce a specific set of ownerships and permissions at the receiving end, not protect the source end.

share|improve this answer
add comment

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.