I can't seem to find a close enough example but here it goes.

I'm trying to in the end setup rsync from one server to another through an ssh tunnel. Local (my machine) will run the rsync to pull files from a remote server through the ssh tunnel.

I can connect with this command:

$ ssh -L 1522:localhost:middlemanip:1521 user@server

My rsync attempts led me to try this:

$ rsync -avz -e "ssh localhost:1522:middlemanip:1521 ssh" \
    user@server:/source /dest/

But this doesn't seem to work. I moved to autossh where I attempted this:

$ autossh -M 1522 -q -f -N -o "ServerAliveInterval 60" \
    -o "ServerAliveCountMax 3" -L localhost:middlemanip:1521 user@server

No luck so far, but there may be a better way to do this then what I have laid out?

  • Take a look at the methods I describe here: Is it possible to have multiple SSH host aliases?
    – slm
    Oct 21, 2014 at 15:31
  • Yeah that doesn't really help. Thats the same info that's out there. I'm looking for someone who setup a persistent tunnel to rsync over.
    – Douglas
    Oct 21, 2014 at 16:02
  • Those can be used when you invoke your rsync -e "....". I use autossh for a persistent tunnel to my IMAP and SMTP servers at home when travelling via my laptop, from what you've described you do not need persistence, only a proxy connection for the duration of the rsync.
    – slm
    Oct 21, 2014 at 16:04

1 Answer 1


I have found this link on SSH ProxyCommand to be a very useful way to enable SSH proxies. It lets you go from Server --to-->proxy---to-->destination very easily and transparently!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .