48

I'm am using ProxyJump in my ~/.ssh/config

Host jump                                                                          
  User jane                                                                       
  HostName 1.2.3.4
  DynamicForward 1028
Host dev                                                                        
  User bill                                                                      
  HostName 5.6.7.8                                                          
  ProxyJump jump

My colleague is using an old version of ssh (which they are unable to update). What would be the equivalent configuration to allow them to connect via the jump host? Would DynamicForward still work?

2
  • What version of ssh is your colleague using?
    – Kenster
    Sep 27, 2017 at 12:58
  • It's the OSX 10.10 version - ssh 6.x something. Sep 28, 2017 at 1:37

1 Answer 1

66

ProxyJump was added in OpenSSH 7.3 but is nothing more than a shorthand for using ProxyCommand, as in:

Host hidden-host
  ProxyCommand ssh proxy-host -W %h:%p

If your ssh version is even older, you might lack the -W option, in which case you can use nc, as in:

Host hidden-host
  ProxyCommand ssh proxy-host nc %h %p 2> /dev/null
5
  • 9
    In a terminal/cmd this would look like this: ssh -o ProxyCommand="ssh <proxy-host> -W %h:%p" <target> instead of ssh -J <proxy-host> <target>
    – igor
    Apr 9, 2018 at 16:21
  • 2
    Here is an additional good source that talks about using ProxyCommand when ProxyJump is not available. en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts Aug 14, 2020 at 12:53
  • Also note that when using dynamic proxy host-names (example), echo works in both ProxyJump and ProxyCommand, but sed only works in ProxyCommand.
    – Bojan P.
    Nov 16, 2020 at 10:59
  • When you use ssh -J <proxy-host> <target>, you will see the process ssh -W [<target>]:22 <proxy-host>, which tells me that -J is nothing but a syntax sugar.
    – puravidaso
    Dec 23, 2020 at 6:21
  • The proxyCommand is interpreted by the shell, so not only echo and sed will work, but also any command such as ruby. If you set Host to be <proxy-host>~* (dynamic), then you can configure ProxyCommand as: ProxyCommand ssh $(echo %h | ruby -pe '$_.sub!(/~.*/,"")') -W $(echo %h | ruby -pe '$_.sub!(/.*~/,"")'):%p
    – puravidaso
    Dec 23, 2020 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.