ssh - 通过 ssh 隧道进行 rsync

标签 ssh rsync ssh-tunnel

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

假设我首先连接到

  ssh user@bridge 

然后从那里到

  ssh user@clusternode

现在我想从我的工作站 rsync 到集群节点。我执行以下操作:

  • 我打开一个 ssh 隧道

    ssh -L8000:clusternode:8000 user@bridge
    
  • 我从我的工作站 rsync 到集群节点

    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 守护进程

最佳答案

试试这个单行:

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

关于ssh - 通过 ssh 隧道进行 rsync,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16654751/

相关文章:

go - 关闭加密 ssh session 以释放 golang 中所有资源的正确方法?

ssh - 我可以通过 ssh 获取在子 shell 中执行的命令的退出代码吗?

php - 从 Linux 子系统 SSH 到 wamp 服务器 apache/php

ssh - GitLab SSH 克隆失败; HTTP 工作

ruby - 将文件夹从 server1 复制到 server2 从 localhost linux 运行脚本

rsync --delete --files-from=list/dest/不删除不需要的文件

python - 允许 Rsync 读取 python 进程打开的文件,而不会导致 python 进程失败

mysql - AWS - 用于访问 RDS 的 Bastion ssh 隧道 - 连接到 SSH 服务器但不连接 MySQL 服务器

ssh - 我可以将这些SSH隧道命令合并为一个命令吗?

mysql - "Can' t 使用 SSH 隧道连接到本地 MySQL 服务器