从一台外部服务器到另一台的 SCP

Liz*_*ard 12 linux ssh bash scp

我试图在我的本地服务器上使用 SCP 将文件从一个远程服务器复制到另一个远程服务器(两个远程服务器都使用自定义端口(xxxx)

我在尝试:

scp -r -P xxxx root@xxx.xxx.xxx.111:/home/myimages/images.tar.gz root@xxx.xxx.xxx.222:/home/myimages/images.tar.gz
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

ssh: connect to host xxx.xxx.xxx.222 port 22: Connection timed out
Run Code Online (Sandbox Code Playgroud)

有什么建议?

jhw*_*ist 18

您是否检查过从第一个远程主机到第二个远程主机的直接身份验证是否有效?

scp user@host:/file user@otherhost:/otherfile 是简写

ssh user@host scp /file user@otherhost:/otherfile

这让我想到:

ssh -p XXX user@host scp -P XXX /file user@otherhost:/otherfile 可能工作。