SSH and rsync server (tunnelling)

Lars E. D. Jensen lars at dangvard.dk
Fri Aug 20 11:14:11 GMT 2004


Lars E. D. Jensen wrote:
> Hi
> 
> Thanks for your previous answers.
> Now I'm fighting with setting up ssh tunnelling with rsync

Hi

Just wanted to share this with other "rsync through tunnelling" newbies.
This script will copy files from "remotehostname" to "localhostname" 
with permissions/ownership etc. preserved AND with encrypted transfer.

This is the script I've made:

---cut---

#!/bin/bash

# Sets up tunnelling, dsa key needed for ssh autologin (needs to be 
explicit given to the command).:

ssh -i /home/rsync/.ssh/id_dsa -f -C -L 2211:remotehostname:873 
rsync at localhostname sleep 1000

# ENV var RSYNC_PASSWORD gets destroyed when this script is finish 
executing. Needed for rsync autologin.:

export RSYNC_PASSWORD=somepassword
rsync -auz --delete rsync://rsync@localhost:2211/www /var/www

# only list files, test purposes only...
# rsync rsync://rsync@localhost:2211/www

---cut---

The script is dependent on a rsync server running on "remotehostname".
I have the rsync server running through daemon tools 
(http://cr.yp.to/ucspi-tcp.html) with restricted access using tcprules.
The script also needs to be executed on "localhostname" in order to work 
as meant to...

-- 
Med venlig hilsen / Best regards

Lars E. D. Jensen
lars at dangvard.dk


More information about the rsync mailing list