Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

Your Answer


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.