Thursday, August 16, 2007

rsync over ssh

I wanted to start using rsync to mirror some our iTunes library across our computers.  On the main computer, I would rsync the iTunes library to our server, and then on all the other computers, I would rsync the library back down.

I also want to run rsync on the server in daemon mode, as there are some nice configuration options to specify "modules" for the different data that I wanted to synchronize.

After looking into this, there were a few things that I didn't like with the default solution.

  1. I  didn't want to open the rsyncd port through my firewall.  (Even though I could have specified authentication crednetials.)

  2. If I want to use rsync's ssh support, and want to define all of the modules in /etc/rsyncd.conf, I would have to give the root user the ability to login in through ssh.

Here is how I set this up:

Created rsynd.conf in the home directory of the non-root user on the server:

  path = /data/iPhoto
  read only = false
  comment = iPhoto backup
  list = yes
  use chroot = false

Make sure the location specified by "path" on the server is writable by this non-root user.

Use the following command on the source computer:

rsync -azvE -r -n --exclude '.DS_Store' --delete --verbose --progress --rsh="ssh -l user" /Users/Shared/iPhoto\ Library\ Library