Skip to main content
1 of 2

SSH Tunnel with autossh

I can't seem to find a close enough example but here 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?