45

我想 rsync 到一个集群节点,我通常通过另一个系统连接到该节点:

说我先连接到

  ssh user@bridge 

从那里到

  ssh user@clusternode

现在我想从我的工作站 rsync 到 clusternode。我执行以下操作:

  • 我打开一个 ssh 隧道

    ssh -L8000:clusternode:8000 user@bridge
    
  • 我从我的工作站同步到 clusternode

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

它不起作用,我明白了

 ssh_exchange_identification: Connection closed by remote host

为什么它不起作用?我需要做什么?


我在这里找到了很多信息:

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

我想了解我的问题是网桥和目的地之间的第二次身份验证,所以我改为方法 2 也不是很优雅,但它有效。我想尝试方法 3,但我不知道如何配置 rsync 守护进程

4

3 回答 3

85

试试这个单行:

rsync -av -e "ssh -A root@proxy ssh" ./src root@target:/dst
于 2014-02-14T19:31:09.020 回答
39

这对我有用。

我在后台运行一个命令来隧道到远程主机:

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

然后我像这样 rsync 到 localhost:

rsync -auve "ssh -p 2222" . me@localhost:/some/path
于 2014-01-30T18:57:05.277 回答
5

您应该连接到 clusternode 的端口 22,所以隧道应该看起来像

ssh -L localhost:8000:clusternode:22 user@bridge
于 2013-12-17T19:52:56.590 回答