Tech Topics: Backing up my Lightroom work with rsync over SSH

I’ve set up Lightroom on my laptop as the repository of the pictures I’m taking on the trip. Getting the photos into Lightroom is easy, but I want to replicate everything to my server at home for backup purposes.

I have one machine at home with its SSH port exposed to the Internet; it’s not the machine I want to send the files to. So I need to use an SSH tunnel to get to the actual target machine (I’m using rsync to do the copy to avoid sending more data than I need, especially when connected over my phone).

I have set up both machines at home to trust my SSH key, so passwords and passing certificates aren’t a problem. I’ve defined home in my local .ssh/config file to point to my gateway system’s SSH port, so I can set up the tunnel by opening a terminal window and issuing this command:

ssh -NL 9091:office:22 home

9091 is an arbitrary port number; it can be anything more than 1024.
office is the system I want to connect to at home; I could also use the local network address at home (for example, 192.168.99.99).

Now I’m ready to do the copying; I need to open another terminal window and issue this command:

rsync -auv -e "ssh -p 9091" \
--exclude '*Previews*' --exclude '*ackup*'  \
~/Pictures/Lightroom david@localhost:Desktop/East

The Desktop/East directory on my home server is an image of the Lightroom directory here (including the catalog). If I were really brave, I could add --delete to the command to ensure that any deletions I make on the laptop are reflected at home.

After the copy is complete, I can go back to the first window and stop the SSH session.

When I get home, I plan to import the catalog from my laptop into my master Lightroom library, but if something happens to my laptop on the way home, I should be able to use the backup I’m creating.

I hope.