Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 847
simona Avatar asked May 20 '13 17:05

simona


People also ask

Can you rsync over ssh?

Rsync stands for "Remote Sync." The rsync command lets you transfer and synchronize data between different machines and directories. Using the Secure Shell (SSH) protocol, you can copy your files securely to another location. The rsync tool has many benefits when compared to other methods for copying files.

How do I use rsync with SSH keys?

Using rsync With SSH and Your Key If you want details on what SSH is doing, add "-v" to the ssh options. To run rsync quietly, remove the "-v" option from both rsync and SSH option list. To reverse the synchronization so the remote file is updated on your local computer, reverse the source and destinations.

How do I transfer files using rsync?

If you want to copy a file from one location to another within your system, you can do so by typing rsync followed by the source file name and the destination directory. Note: Instead of “/home/tin/file1. txt”, we can also type “file1” as we are currently working in the home directory.

Which port does rsync use?

As we already know, rsync uses the default SSH port 22 to sync files from remote to localhost and vice versa.


1 Answers

Try this one-liner:

rsync -av -e "ssh -A root@proxy ssh" ./src root@target:/dst 
like image 98
skroll Avatar answered Sep 22 '22 13:09

skroll