rsync through ssh tunnel [closed]

I want to rsync to a cluster node to which I usually connect passing through another system:

Say I connect first to

  ssh user@bridge 

and from there to

  ssh user@clusternode

Now I want to rsync from my workstation to clusternode. I do the following:

  • I open a ssh tunnel

    ssh -L8000:clusternode:8000 user@bridge
    
  • I rsync from my workstation to clusternode

    rsync -e "ssh -p8000" source user@localhost:destination
    

and it does not work, I get

 ssh_exchange_identification: Connection closed by remote host

Why does it not work? What do I have to do?


I have found a lot of information here:

http://toddharris.net/blog/2005/10/23/rsyncing-through-an-ssh-tunnel/

I think to understand that my problem is the second authentication between the bridge and the destination, so I changed to method 2 that is also not very elegant, but it works. I would like to try method 3, but I don't know how to configure a rsync daemon


Try this one-liner:

rsync -av -e "ssh -A root@proxy ssh" ./src root@target:/dst

Here's what worked for me.

I run a command in the background to tunnel to the remote host:

 ssh -N -L 2222:remote.example.com:22 bridge.example.com&

then I rsync to localhost like this:

rsync -auve "ssh -p 2222" . me@localhost:/some/path

You should connect to the port 22 of clusternode, so the tunnel should look like

ssh -L localhost:8000:clusternode:22 user@bridge