0

My config file is as follows (I'm trying to directly ssh into foo):

Host foo
    HostName <ip>
    User <username>
    ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -q -W %h:%p jump

Host jump
    HostName <ip>
    User <username>
    ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -q -W %h:%p bar

Host bar
    HostName <ip>
    User <username>
    Port <num>

In addition, I have concatenated my id_rsa.pub key to authorized_keys of bar, jump and foo servers. When I run ssh -J foo jump bar, I get the error CreateProcessW failed error:2 posix_spawn: No such file or directory. When I try ssh foo -v I get the following:

OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\CCL/.ssh/config
debug1: C:\\Users\\CCL/.ssh/config line 7: Applying options for foo
debug1: Executing proxy command: exec C:\\Windows\\System32\\OpenSSH\\ssh.exe -q -W <jump_ip> jump
debug1: identity file C:\\Users\\CCL/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7

Similarly, when I try ssh jump -v, I get

OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data C:\\Users\\CCL/.ssh/config
debug1: C:\\Users\\CCL/.ssh/config line 12: Applying options for jump
debug1: Executing proxy command: exec C:\\Windows\\System32\\OpenSSH\\ssh.exe -q -W <bar_ip:port_num> bar
debug1: identity file C:\\Users\\CCL/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\CCL/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7

The ssh process seems to be stuck and never authenticates nor does the key exchange. How do I fix this?

1
  • What's with the ProxyCommand lines? Oct 16 '20 at 4:56
0

It sounds like you're trying to use bar as a jump host to connect to jump, and use jump as a jump host to connect to foo. In other words, trying to connect to bar like this:

local --> foo --> jump --> bar

Your ssh config should look like this:

Host foo
    HostName <ip>
    User <username>
    ProxyJump jump

Host jump
    HostName <ip>
    User <username>
    ProxyJump bar

Host bar
    HostName <ip>
    User <username>
    Port <num>

And then to connect, run just ssh bar.

ProxyJump is a simpler way to get what you want compared to ProxyCommand, assuming you're using OpenSSH 7.3 or newer. Additionally, you don't need to use -J on the ssh command. -J sets ProxyJump for the current invocation, which is unneeded if it's already in your config file.

1
  • 1
    It seems out of order on some points. The TCP connections go like these: local --> bar --> jump --> foo. "And then to connect, run just" I think needs ssh foo
    – kubanczyk
    Oct 17 '20 at 14:16

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.