本文介绍了使用Jump Host的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将文件从本地计算机传输到需要通过跳转主机的远程主机?这些是我连接到远程主机所遵循的步骤

How do I transfer a file from my local machine to a remote host to which I need to get through a jump host? These are the steps I follow to connect to the remote host

1. ssh myname@jump-host
2. enter password
3. sudo su - another-random-name
4. ssh name@remote-host

现在,我要将文件从本地计算机传输到远程主机.我将如何实现呢?我已经尝试过 scp -oProxyCommand ,但是我不太清楚在该命令中应将第3步包括在什么地方?

Now I want to transfer a file from my local machine to the remote-host. How would I achieve this? I have already tried scp -oProxyCommand but I don't quite know where I should include step 3 as part of this command?

推荐答案

在以另一个随机名称运行的跳转主机上

On the jump host under another-random-name run

ssh -L 2222:remote-host:22 myname@jump-host

然后在您的本地计算机上运行

then on your local computer you can run

scp -P 2222 file name@jump-host:

SCP将尝试连接到 jump-host ,而实际上此连接将被转发到Jump-host.并且将使用 name 连接到远程主机.您可能仍面临另一个随机用户的证书问题.您可以在计算机上为本地用户创建证书,然后将公共密钥放在用户允许的密钥中的远程主机上.

SCP will try to connect to jump-host, while in fact this connection will be forwarded to jump-host. And will use name as it is connecting to remote-host.You are probably still facing problem with certificate for another-random-user. You can either create certificate on your machine for your-local-user and put public key on remote-host in user allowed keys.

这篇关于使用Jump Host的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 18:59