我需要通过多个跳转主机将文件从远程主机同步到我的本地机器。我想使用共享 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 远程文件
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]
并且仍然得到相同的错误。
动态链接库存在一些问题。
在远程机器上解决了这个问题。