通过多路复用 SSH 连接和多个跳转主机进行 rsync

通过多路复用 SSH 连接和多个跳转主机进行 rsync

我需要通过多个跳转主机将文件从远程主机 rsync 到本地计算机。我想使用共享 SSH 连接,这样我就不必在某些跳转主机上多次提交 2FA。

我的想法是创建一个主连接

ssh user@jumphost01

然后是其他连接

ssh -J user@jumphost01,user@jumphost02 root@target01
...

共享连接控制文件~/.ssh/如下所示

control:target01:22:root
control:jumphost01:22:user
control:jumphost02:22:user

现在我希望我可以使用

rsync -azv -e 'ssh -o ControlMaster=auto' root@target:/somePath/someFile someFile
or
rsync -azv root@target:/somePath/someFile someFile
or    
rsync -azv -e 'ssh -F /root/.ssh/config' root@target:/somePath/someFile someFile

但我收到 rsync 错误

receiving incremental file list
someFile
WARNING: someFile failed verification -- update discarded (will try again).
someFile
ERROR: someFile failed verification -- update discarded.

sent 68 bytes  received 317 bytes  770.00 bytes/sec
total size is 305  speedup is 0.79
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1819) [generator=3.2.3]

Rsync 能够连接到目标但文件传输失败。

rsync 版本

local machine - rsync  version 3.2.3  protocol version 31
target machine - rsync  version 3.2.3  protocol version 31

TLDR;

我测试了没有 SSH 主连接的 rsync 命令

rsync -azv -e 'ssh -J user@jumphost01,user@jumphost02' root@target01:someFile .
One-time password (OATH) for `user': 
Password: 
receiving incremental file list
someFile
WARNING: someFile failed verification -- update discarded (will try again).
someFile
ERROR: someFile failed verification -- update discarded.

sent 68 bytes  received 2,767 bytes  195.52 bytes/sec
total size is 18,976  speedup is 6.69
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1819) [generator=3.2.3]

但仍然出现同样的错误。

答案1

动态链接库存在一些问题。

# apt update && apt upgrade

远程机器上的问题解决了。

相关内容