替换 ~/.ssh/config 中的 ProxyJump

Son*_*ton 45 ssh

我正在使用ProxyJump我的~/.ssh/config

Host jump                                                                          
  User jane                                                                       
  HostName 1.2.3.4
  DynamicForward 1028
Host dev                                                                        
  User bill                                                                      
  HostName 5.6.7.8                                                          
  ProxyJump jump
Run Code Online (Sandbox Code Playgroud)

我的同事使用的是旧版本的 ssh(他们无法更新)。允许他们通过跳转主机连接的等效配置是什么?将DynamicForward仍然工作?

cri*_*ret 60

ProxyJump是在 OpenSSH 7.3 中添加的,但只不过是 using 的简写ProxyCommand,如:

Host hidden-host
  ProxyCommand ssh proxy-host -W %h:%p
Run Code Online (Sandbox Code Playgroud)

如果您的ssh版本更旧,您可能缺少该-W选项,在这种情况下,您可以使用nc,如下所示:

Host hidden-host
  ProxyCommand ssh proxy-host nc %h %p 2> /dev/null
Run Code Online (Sandbox Code Playgroud)

  • 在终端/cmd 中,这看起来像这样:`ssh -o ProxyCommand="ssh <proxy-host> -W %h:%p" <target>` 而不是 `ssh -J <proxy-host> <target> ` (9认同)
  • 这是一个额外的好资料,讨论了当“ProxyJump”不可用时使用“ProxyCommand”。 https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts (2认同)