我在一所大学工作,我们有一台远程机器(1),我可以通过 ssh 进入。
要在我的笔记本电脑上执行此操作,我相信我必须先通过 ssh 进入大学系统,然后通过 ssh 进入特定机器。这一切对我来说都是自动发生的,因为已经为我设置了 ssh 配置文件。我只是输入:
ssh -Y comp_name
Run Code Online (Sandbox Code Playgroud)
我在。
我目前正在尝试从一个完全不相关的删除机器(2) ssh - 与大学无关。为了从这个 ssh 进入我的 remote_machine(1),我做了两个单独的 ssh:
1. Into the university (ssh-gateway)
2. Into remote_machine(1)
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好。
我想要做的是使用 scp 将文件从 remote_machine(2) 传输到 remote_machine(1)。当涉及这两个步骤时,我该怎么做?
我最初尝试:
scp ./file.txt username@ip_of_remote_machine(1)
Run Code Online (Sandbox Code Playgroud)
但它说
connection refused
Run Code Online (Sandbox Code Playgroud)
我想这是因为我需要先进入大学网络。
我知道我的术语不正确,但希望你明白我的意思。
首先,您不需要分两步登录 remote_machine(1):以下命令
ssh -t me@universitygateway ssh me@remote_machine(1)
Run Code Online (Sandbox Code Playgroud)
如果您已启用(据我所知)无密码登录,将为您完成此操作。
至于scp'ing,您可以按如下方式进行:
scp -o ProxyCommand="ssh me@universitygateway nc remote_machine(1) 22" remote_machine(1):/path/to/file/to/download .
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1212 次 |
| 最近记录: |