如何使用来自第三台本地机器的 scp 在两个远程服务器之间传输文件? [英] How to transfer a file between two remote servers using scp from a third, local machine?
问题描述
我正在尝试从我的本地机器上将一个文件从一个远程服务器复制到另一台远程服务器.这就是我想要做的
I'm trying to copy a file from one remote server to another remote server from my local machine. Here's what I'm trying to do
localA $ scp userB@remoteB:/path/to/file userC@remoteC:/path
问题是我需要在远程机器上为 userB 和 userC 传递两个密码.
The problem is that I need to pass two passwords for both userB and userC on the remote machines.
根据 Garron 以上应该可行,但我的许可被拒绝.
According to Garron the above should work, but I got permission denied.
Permission denied (gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive).
lost connection
有什么建议吗?
推荐答案
这个问题已经存在于超级用户:
This questions already exists on Superuser:
https://superuser.com/questions/686394/scp-between-two-remote-hosts-from-my-third-pc
scp -3 user1@remote1:/home/user1/file1.txt user2@remote2:/home/user2/file1.txt
如上所述 -3 选项指示 scp 通过发出命令的 PC 路由流量.
As described there -3 option instructs scp to route traffic through the PC on which the command is issued.
如果 remote1 和 remote2 在同一网络上,则上述情况成立.
The above is true if remote1 and remote2 are on the same network.
如果不是:- 您必须使用端口转发
In case not:- You have to use port forwarding
这篇关于如何使用来自第三台本地机器的 scp 在两个远程服务器之间传输文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!