Setting up Rsync
I was getting fed up with having to synchronize several folders containing photos. So I was looking for a good way to synchronize these images across the network. I first tried to put the images into Subversion but this turned out to be overkill. So that’s why I put my focus on Rsync.
Rsync has support for incremental file exchange. Not that I am going to use it but it still is cool. I will only use Rsync to keep my photo directories synched with the server. So lets install it.
apt-GET install rsync
Edit the rsyncd.conf file in the /etc directory and create some entries here. Example is my photos entry here.
#/etc/rsyncd.conf #file containing username+passwords IN the form <name>: <password> the file should be readable ONLY BY USER OR GROUP. #so chmod 660 OR 600 would be necessary. secrets file = /etc/rsyncd.secrets motd file = /etc/rsyncd.motd #Below are actually defaults, but TO be ON the safe side... READ ONLY = yes list = yes # WITH what USER permissions should rsync handle directories? uid = nobody #gid = nobody #On debian GROUP nobody IS mapped TO nogroup gid = nogroup #if stricts mode IS TRUE secrets file should NOT be readable BY ALL. TO disable this turn stricts mode TO off. (built IN FOR cygwin users) strict modes = TRUE [photos] comment = Family Photos path = /share/photos auth users = wytze,wytske READ ONLY = no hosts allow = 192.168.* hosts deny = * list = FALSE </password></name>
Start the rsync daemon:
rsync --daemonNow you can start synchronizing. Synchronizing works like copying files with scp. So it’s fairly straightforward.
To retrieve a list of entries if listing is enabled:
rsync -avz wytze@debian::To synchronize files from server:
rsync -avz wytze@debian::photos /opt/my-local-photos
To synchronize files to the server:
rsync -avz /opt/my-local-photos/ wytze@debian::photos
Please mind the trailing slashes. Try out the difference with and without the trailing slash. Pretty straightforward there.