You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature-requestRequest for new features or functionalitysshIssue in vscode-remote SSHupstreamIssue identified as 'upstream' component related (exists outside of VS Code Remote)windowsIssue on Windows
Some users may leverage ~/.ssh/config to set up ProxyJump and ProxyCommands to get to their endpoints. Currently, it appears that VSCode Remote only supports a direct connection.
Reacted by Digital Chris, Ray Fang, rvalkenaers, Bryan Hitchcock, Jiaxun Wei, Sean Millichamp, Pete Davison, Paul Owen, Taylor Ralston, autopilotfuturemind and 29 more
I'm able to connect to a JumpHost endpoint. Mine are configured in my config file. The only thing I had to do was copy my SSH key to the remote endpoint (and jump hosts). For example, if my config was: local -> jump1 -> jump2 -> server
Then I'd have to run "ssh-copy-id" for jump1, then for jump2, then for server. After that, VSCode connected just fine.
Reacted by Arno Gobbin, Bruno Gomes and William Droz
I am able to do the same, but what I found was that I could do the following:
local -> server = OK
local -> jump1 -> server = able to authenticate, but unable to connect.
I do know that when VSC connects to the remote server, it attempts to install or run a service. My suspicion is that by jumping through from X to Y to Z, the service ends up installing on Y and not X. Perhaps maybe there’s a better way to pivot using JumpHost as you said rather than ProxyCommand.
@TheStoof I just attempted the same connection, but from a Windows 10 machine with WSL, and it didn't work (same problem as #34). It did work though from my Mac.
Yea, tried various options and nothing succesful to far. I was able to connect once by creating a tunnel in WSL and pointing the Hostname and Port to the tunnel but wasn't able to repeat.
Ran into this issue while trialing Remote SSH as an alternative to local development. Connecting from a Windows 10 machine to a remote box works, but only when connecting directly. We cannot connect to any hosts via a jumpbox. In other words:
local -> jumpbox works
local -> jumpbox -> remote doesn't work
Here's my (sanitized) config:
Host jumpbox
HostName 12.34.56.78
Port 22
User user
Host remote
Hostname 172.16.0.1
Port 22
User user
ProxyJump jumpbox
There is no way for us to SSH into a remote machine without tunneling through a jumpbox, so this functionality it absolutely necessary for us to use Remote - SSH.
Reacted by Mat, Chun-Jie Liu, River News, Jeffrey Reeves, mohammed Chakib Belgaid, Ph.D, mcajkovs, Tom Lockwood, Riley Bakes, Ben, secrecys and 1 more
I'm trying to solve this issue by writing a new RemoteAuthorityResolver, which the Remote SSH and Remote Container based on. But there is no document about this API...
I decided to try SSHing (with the same config as above) to my remote boxes via Powershell today. This should use the same version of SSH as the Remote - SSH extension (rather than the WSL version of SSH).
Unsurprisingly, I got exactly the same result, but a better error message
local -> jumpbox works
local -> jumpbox -> remote fails with the error:
CreateProcessW failed error:2
posix_spawn: No such file or directory
A quick search of the error found PowerShell/Win32-OpenSSH#1185.
Not 100% sure if related, but that issue was fixed in Jan which implies that if that issue is the problem, this would be fixed in 1903. Unfortunately, we're still on 1809 at work, so I can't test.
A bit more searching also found PowerShell/Win32-OpenSSH#1172. This issue seems more relevant than 1185, but is still open 😢
Reacted by Taylor Ralston, Caleb Collins-Parks, qutong, Lucas Theisen and William Droz
Host jumpbox
HostName example.edu.cn
User U
Port xxx
IdentityFile xxx.id_rsa
Host remote
HostName remote
User U
Port xx
ProxyCommand ssh -q -W %h:%p jumpbox
On Git Bash(windows)
$ ssh -V
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
local -> jumpboxworks
ssh jumpbox
local -> jumpbox -> remoteworks
ssh remote
On Powershell:
ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
local -> jumpboxworks
ssh jumpbox
local -> jumpbox -> remotefails with the error:
ssh remote
CreateProcessW failed error:2
posix_spawn: No such file or directory
On VS Code:
local -> jumpboxworks
local -> jumpbox -> remotefails with the error:
Picking SSH host
Selected remote
Confirming that remote is a valid reachable host
Running type "C:\Users\xxx\AppData\Local\Temp\vscode-linux-multi-line-command-remote.sh" | ssh "remote" bash to confirm the host platform
>
> CreateProcessW failed error:2
> posix_spawn: No such file or directory
>
"uname" terminal command done
remote: unreachable or not Linux x86_64. (posix_spawn: No such file or directory)
It worked as expected on Windows 10 1809 but there is probably bug in 1903 and this worked for me.
Reacted by Maxim Bonnaerens, Yixuan Ren, DENG-Yifan, Max Solomčuk, Known Rabbit, IchHabeKeineNamen, Sukrut Rao, hwgao, eugenelyj, junewhee Ahn and 16 more
eromoe Unfortunately, that's still version 7.7 which does not contain the fix. You'll need to manually update to v8.0+ or use one of the other workarounds mentioned above.
It has been confirmed in another issue that v8.1 will be released in an update later this year, but is not included in Windows 10 2004 (20H1):
v8.1 goes into the next release (not into win10 version 2004) available during fall time.
eromoePete Davison (@pd93) Did you solve the problem after upgrading to Windows 10 2004 by patching it again. I meet the same problem after I upgrade to Windows 10 2004. But patching manually updating to v8.0+ does not solve this problem.
specifying identity files, ssh config files, netcat etc. on ProxyCommand did not work for me -- but I did not test an absolute ssh path, just added .exe
As for my ssh-key login:
For both hosts, I needed to specify my id_rsa_vscode file. That I needed to do regardless of proxying or not.
And I needed to copy my keys with ssh-copy-id to the remote hosts. I also needed to specify -f because I used different id_rsa files for normal ssh login in WSL and for VSCode, and without -f it would not copy the second VSCode ssh key. (That was neccessary because VSCode could not work with ssh-agent or password protected ssh identity files - as far as I know - without always typing the remote ssh passwords on each (re-)connect.)
A quick update for anyone following this issue. MSFT currently have a pinned issue explaining why OpenSSH was not included in the 20H2 release. I've updated my workaround comment above to reflect this.
The manual fix by Pete Davison (@pd93) worked like a charm for me, but a Windows update seems to have overwritten the updated ssh.exe. Rather than potentially having to replace the executable after future updates I simply extracted the zip to a different location and added it to the systems PATH. My steps:
Extract to a suitable location, e.g. C:\bin\OpenSSH-Win64
Open Edit the system environmental variables (found in the control panel or start menu)
Edit the Path variable and add C:\bin\OpenSSH-Win64
Make sure that the new entry is above the entry %SYSTEMROOT%\System32\OpenSSH\
Restart VSCode
Note that I had to edit PATH for the whole system, not my user. In the latter case the entry will be added after the system version giving it precedence.
Beware that sometime in the future this solution could cause problems if the system OpenSSH version is updated to a more recent version than the manually installed one...
Copy and replace the extracted ssh.exe binary into your C:\Windows\System32\OpenSSH folder.
Done! You can now use "Remote Development - SSH" with ProxyJump in the expected way.
If you get a permissions error then this may be because there is system protection in place on the existing ssh.exe binary. This can be removed by setting yourself as the owner of the file (requires admin) and granting yourself "full control". To do this, follow these steps:
Right-click on the existing file C:/Windows/System32/OpenSSH/ssh.exe and select Properties.
Open the Security tab and click on Advanced.
Click the button to change the owner and change it from TrustedOwner to your Windows username.
Type your username and click the Check Names button (This should autofill with your full username/email).
Apply the settings and then close the properties window and reopen it.
Navigate back to the Security tab and click on Edit.
Select the Users group and give the group Full Control.
Click Apply and exit.
Now go back and try patching the file again.
Worked without any issues. I've used MobaXterm for a long time to first setup the tunnel and then just connect to the destination, but now it's not needed anymore with ProxyJump working correctly.
specifying identity files, ssh config files, netcat etc. on ProxyCommand did not work for me -- but I did not test an absolute ssh path, just added .exe
As for my ssh-key login:
For both hosts, I needed to specify my id_rsa_vscode file. That I needed to do regardless of proxying or not.
And I needed to copy my keys with ssh-copy-id to the remote hosts. I also needed to specify -f because I used different id_rsa files for normal ssh login in WSL and for VSCode, and without -f it would not copy the second VSCode ssh key. (That was neccessary because VSCode could not work with ssh-agent or password protected ssh identity files - as far as I know - without always typing the remote ssh passwords on each (re-)connect.)
life saving!!! I had to log in to appreciate your share! Got mine solved! thanks!
roblourens I believe this can be closed now. This was never a VSCode issue and it should now be resolved anyway as a newer (and working) version of OpenSSH is now included in the latest version of Windows.
Anyone on older versions of Windows (and therefore OpenSSH) can follow the manual steps I outlined earlier in this issue in order to update.
feature-requestRequest for new features or functionalitysshIssue in vscode-remote SSHupstreamIssue identified as 'upstream' component related (exists outside of VS Code Remote)windowsIssue on Windows
Activity
tralston commentedon May 3, 2019
I'm able to connect to a JumpHost endpoint. Mine are configured in my config file. The only thing I had to do was copy my SSH key to the remote endpoint (and jump hosts). For example, if my config was:
local -> jump1 -> jump2 -> serverThen I'd have to run "ssh-copy-id" for jump1, then for jump2, then for server. After that, VSCode connected just fine.
Stephen9s commentedon May 3, 2019
I am able to do the same, but what I found was that I could do the following:
local -> server = OK
local -> jump1 -> server = able to authenticate, but unable to connect.
I do know that when VSC connects to the remote server, it attempts to install or run a service. My suspicion is that by jumping through from X to Y to Z, the service ends up installing on Y and not X. Perhaps maybe there’s a better way to pivot using JumpHost as you said rather than ProxyCommand.
I’ll give ProxyJump a shot.
tralston commentedon May 3, 2019
@TheStoof for what it's worth, here's an excerpt from my config file (sanitized):
tralston commentedon May 3, 2019
@TheStoof I just attempted the same connection, but from a Windows 10 machine with WSL, and it didn't work (same problem as #34). It did work though from my Mac.
msalvaris commentedon May 7, 2019
Yea, tried various options and nothing succesful to far. I was able to connect once by creating a tunnel in WSL and pointing the Hostname and Port to the tunnel but wasn't able to repeat.
pd93 commentedon May 9, 2019
Ran into this issue while trialing Remote SSH as an alternative to local development. Connecting from a Windows 10 machine to a remote box works, but only when connecting directly. We cannot connect to any hosts via a jumpbox. In other words:
local -> jumpboxworkslocal -> jumpbox -> remotedoesn't workHere's my (sanitized) config:
Host jumpbox HostName 12.34.56.78 Port 22 User user Host remote Hostname 172.16.0.1 Port 22 User user ProxyJump jumpboxThere is no way for us to SSH into a remote machine without tunneling through a jumpbox, so this functionality it absolutely necessary for us to use Remote - SSH.
LeuisKen commentedon May 10, 2019
I'm trying to solve this issue by writing a new
RemoteAuthorityResolver, which theRemote SSHandRemote Containerbased on. But there is no document about this API...suanrong commentedon May 20, 2019
Anyone solve this issue?
msalvaris commentedon May 20, 2019
xuanrong yao (@suanrong)
I was able to overcome the issue by using this method
#117
I create the proxy in wsl and simply make sure that my ssh config points to localhost and the correct port.
pd93 commentedon May 30, 2019
I decided to try SSHing (with the same config as above) to my remote boxes via Powershell today. This should use the same version of SSH as the Remote - SSH extension (rather than the WSL version of SSH).
Unsurprisingly, I got exactly the same result, but a better error message
local -> jumpboxworkslocal -> jumpbox -> remotefails with the error:A quick search of the error found PowerShell/Win32-OpenSSH#1185.Not 100% sure if related, but that issue was fixed in Jan which implies that if that issue is the problem, this would be fixed in 1903. Unfortunately, we're still on 1809 at work, so I can't test.
A bit more searching also found PowerShell/Win32-OpenSSH#1172. This issue seems more relevant than 1185, but is still open 😢
[-]Offer ability to tunnel through to endpoint[/-][+]Can't connect through jumpbox[/+]axiqia commentedon May 31, 2019
I have copyed my SSH key to the remote endpoint and jump hosts as Taylor Ralston (@tralston) suggested. But I still met the issue like Pete Davison (@pd93) . I added more information.
My config:
On Git Bash(windows)
local -> jumpboxworkslocal -> jumpbox -> remoteworksOn Powershell:
local -> jumpboxworkslocal -> jumpbox -> remotefails with the error:On VS Code:
local -> jumpboxworkslocal -> jumpbox -> remotefails with the error:johnymachine commentedon Jun 7, 2019
Maybe this could help:
ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe jumphost netcat -w 120 %h %phttps://serverfault.com/questions/956613/windows-10-ssh-proxycommand-posix-spawn-no-such-file-or-directory
It worked as expected on Windows 10 1809 but there is probably bug in 1903 and this worked for me.
32 remaining items
eromoe commentedon Jun 1, 2020
I patched windows 10 before.
After upgrading to Windows 10 2004(20H1) .
Is this a new but or not ?
pd93 commentedon Jun 1, 2020
eromoe Unfortunately, that's still version 7.7 which does not contain the fix. You'll need to manually update to v8.0+ or use one of the other workarounds mentioned above.
It has been confirmed in another issue that v8.1 will be released in an update later this year, but is not included in Windows 10 2004 (20H1):
anji993 commentedon Jun 7, 2020
eromoe Pete Davison (@pd93) Did you solve the problem after upgrading to Windows 10 2004 by patching it again. I meet the same problem after I upgrade to Windows 10 2004. But patching manually updating to v8.0+ does not solve this problem.
eromoe commentedon Jun 8, 2020
anji993 Patching does sovle my problem , may be something wrong with previllage ?
susguzman commentedon Jun 17, 2020
It worked for me :)
Thank you
nicolaipre commentedon Sep 15, 2020
FWIW: For anyone wanting password authentication only, this config works on Linux for jump-hosts:
tysonite commentedon Oct 24, 2020
Have anyone seen #3857 that with jump server too?
pd93 commentedon Oct 29, 2020
A quick update for anyone following this issue. MSFT currently have a pinned issue explaining why OpenSSH was not included in the 20H2 release. I've updated my workaround comment above to reflect this.
plevold commentedon Dec 11, 2020
The manual fix by Pete Davison (@pd93) worked like a charm for me, but a Windows update seems to have overwritten the updated ssh.exe. Rather than potentially having to replace the executable after future updates I simply extracted the zip to a different location and added it to the systems PATH. My steps:
C:\bin\OpenSSH-Win64C:\bin\OpenSSH-Win64%SYSTEMROOT%\System32\OpenSSH\Note that I had to edit PATH for the whole system, not my user. In the latter case the entry will be added after the system version giving it precedence.
Beware that sometime in the future this solution could cause problems if the system OpenSSH version is updated to a more recent version than the manually installed one...
matijagrcic commentedon Dec 15, 2020
Worked without any issues. I've used MobaXterm for a long time to first setup the tunnel and then just connect to the destination, but now it's not needed anymore with
ProxyJumpworking correctly.AdorableYoyo commentedon Aug 16, 2021
life saving!!! I had to log in to appreciate your share! Got mine solved! thanks!
pd93 commentedon Aug 16, 2021
roblourens I believe this can be closed now. This was never a VSCode issue and it should now be resolved anyway as a newer (and working) version of OpenSSH is now included in the latest version of Windows.
Anyone on older versions of Windows (and therefore OpenSSH) can follow the manual steps I outlined earlier in this issue in order to update.
roblourens commentedon Aug 23, 2021
Thanks for pointing that out Pete Davison (@pd93)