windows 10 ssh proxycommand: "posix_spawn: No such file or directory"

Solution 1:

As per this bug, the fix is to use a full path. So this is the correct line in the .ssh/config:

  ProxyCommand  C:\Windows\System32\OpenSSH\ssh.exe jumphost netcat -w 120 %h %p

For further development see this issue: https://github.com/microsoft/vscode-remote-release/issues/18

Solution 2:

TL;DR

The ProxyCommand should invoke ssh with .exe extension, for example:

ProxyCommand ssh.exe -q -W %h:%p yyy

The long(?) story

Running ssh -vvv XXX shows:

debug3: spawning "C:\\Windows\\System32\\OpenSSH\\ssh -q -W XXX:22 YYY"
CreateProcessW failed error:2
posix_spawn: No such file or directory

According to CreateProcess document on MSDN, I guess posix_spawn is calling CreateProcess in a way that lpApplicationName argument must be exact and absolute path. After specifying the .exe suffix, it seems to be fixed.


Solution 3:

I got same error but it was because of DISPLAY environment variable set to some value. Once you unset that environment variable, the error went away.