我需要在未连接到同一网络的两台计算机之间传输文件。我有第三台可以通过 VPN 看到两个网络的计算机。
在第三台计算机上,我可以执行以下操作:
scp root@firstcomputer:./file ./
Run Code Online (Sandbox Code Playgroud)
并用以下语句完成传输:
scp ./file root@secondcomputer:./
Run Code Online (Sandbox Code Playgroud)
但我不能只在一行中完成,如下所示:
scp root@firstcomputer:./file root@secondcomputer:./
Run Code Online (Sandbox Code Playgroud)
错误响应是
ssh: connect to host secondcomputer port 22: No route to host
lost connection
Run Code Online (Sandbox Code Playgroud)
我意识到这可能是因为第一台计算机无法看到第二台计算机。是否有可能给 SCP 一个参数来处理运行 SCP 程序的机器是唯一可以看到两台计算机的事实?
顺便说一下,第三台计算机是带有 Lion 的 Mac,而第一台和第二台运行的是 Debian。