Cannot connect to remote ssh host after upgrade (whitespace in Windows username)
- VSCode Version: 1.43.0
- OS Version: Windows 10 10.0.17763
Steps to Reproduce:
- Upgrade to 1.43.0
- Have windows home folder with a space
- connect to a system that requires ssh keys and is stored in your
.ssh/config
The following is logged:
[13:18:29.946] Log Level: 2
[13:18:29.956] [email protected]
[13:18:29.956] win32 x64
[13:18:29.959] SSH Resolver called for "ssh-remote+remote-server", attempt 1
[13:18:29.960] SSH Resolver called for host: remote-server
[13:18:29.960] Setting up SSH remote "remote-server"
[13:18:29.964] Acquiring local install lock: C:\Users\FELIXB~1\AppData\Local\Temp\vscode-remote-ssh-remote-server-install.lock
[13:18:29.992] Looking for existing server data file at c:\Users\Felix Bartels\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-remote-server-78a4c91400152c0f27ba4d363eb56d2835f9903a\data.json
[13:18:29.995] Using commit id "78a4c91400152c0f27ba4d363eb56d2835f9903a" and quality "stable" for server
[13:18:29.996] Install and start server if needed
[13:18:30.007] Checking ssh with "ssh -V"
[13:18:30.083] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[13:18:30.084] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[13:18:30.145] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[13:18:30.145] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[13:18:30.378] > OpenSSH_7.9p1, OpenSSL 1.0.2p 14 Aug 2018
[13:18:30.381] askpass server listening on \\.\pipe\vscode-ssh-askpass-1e53feba2800e952d897f64b316a81fe81f3a214-sock
[13:18:30.382] Spawning local server with {"ipcHandlePath":"\\\\.\\pipe\\vscode-ssh-askpass-7a075b36caf5392d3164e31714c2cbc42b439bbe-sock","sshCommand":"C:\\Program Files\\Git\\usr\\bin\\ssh.exe","sshArgs":["-v","-T","-D","54126","remote-server"],"dataFilePath":"c:\\Users\\Felix Bartels\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-vscode-remote.remote-ssh\\vscode-ssh-host-remote-server-78a4c91400152c0f27ba4d363eb56d2835f9903a\\data.json"}
[13:18:30.382] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"c:\\Users\\Felix Bartels\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.50.0\\out\\local-server\\askpass.bat","VSCODE_SSH_ASKPASS_NODE":"C:\\Users\\Felix Bartels\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe","VSCODE_SSH_ASKPASS_MAIN":"c:\\Users\\Felix Bartels\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.50.0\\out\\askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"\\\\.\\pipe\\vscode-ssh-askpass-1e53feba2800e952d897f64b316a81fe81f3a214-sock"}
[13:18:30.462] Spawned 25928
[13:18:30.593] > local-server> Spawned ssh: 24868
[13:18:30.638] stderr> OpenSSH_7.9p1, OpenSSL 1.0.2p 14 Aug 2018
[13:18:30.870] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:jhqlVHf8oBUOkQiMT5zBevNGtATZtVAc7KJ9L5dbwvA
[13:18:31.014] stderr> 'C:\Users\Felix' is not recognized as an internal or external command,
[13:18:31.015] stderr> operable program or batch file.
[13:18:31.049] stderr> 'C:\Users\Felix' is not recognized as an internal or external command,
[13:18:31.049] stderr> operable program or batch file.
[13:18:31.079] stderr> Permission denied, please try again.
[13:18:31.111] stderr> 'C:\Users\Felix' is not recognized as an internal or external command,
[13:18:31.112] stderr> operable program or batch file.
[13:18:31.144] stderr> Permission denied, please try again.
[13:18:31.178] stderr> 'C:\Users\Felix' is not recognized as an internal or external command,
[13:18:31.178] stderr> operable program or batch file.
[13:18:31.209] stderr> [email protected]: Permission denied (publickey,password).
[13:18:31.224] > local-server> ssh child died, shutting down
[13:18:31.244] Local server exit: 0
[13:18:31.245] Received install output: OpenSSH_7.9p1, OpenSSL 1.0.2p 14 Aug 2018
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:jhqlVHf8oBUOkQiMT5zBevNGtATZtVAc7KJ9L5dbwvA
'C:\Users\Felix' is not recognized as an internal or external command,
operable program or batch file.
'C:\Users\Felix' is not recognized as an internal or external command,
operable program or batch file.
Permission denied, please try again.
'C:\Users\Felix' is not recognized as an internal or external command,
operable program or batch file.
Permission denied, please try again.
'C:\Users\Felix' is not recognized as an internal or external command,
operable program or batch file.
[email protected]: Permission denied (publickey,password).
[13:18:31.246] Resolver error: Permission denied (publickey,password).
[13:18:31.250] ------
remote-server is a system that is defined in my ~/.ssh/config
Does this issue occur when all extensions are disabled?: Yes/No
As this is a problem with an extension I did not try the above.
Having the same issue, though doesn't seem to be the same cause. Looks like its probing the system for the highest OpenSSH version:
[14:02:12.903] Checking ssh with "ssh -V"
[14:02:12.996] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[14:02:12.997] Checking ssh with "C:\windows\System32\OpenSSH\ssh.exe -V"
[14:02:13.055] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[14:02:13.055] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[14:02:13.159] > OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019
Which I'm assuming doesn't find my ssh config because it picks the Git ssh executable:
[14:02:13.442] stderr> OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019
[14:02:15.738] stderr> ssh: Could not resolve hostname <server-name>: Name or service not known
[14:02:15.752] > local-server> ssh child died, shutting down
[14:02:15.762] Local server exit: 0
[14:02:15.762] Received install output: OpenSSH_8.2p1, OpenSSL 1.1.1d 10 Sep 2019
ssh: Could not resolve hostname <server-name>: Name or service not known
[14:02:15.767] Resolver error: Could not resolve hostname
Looks like manually specifying the config file path in the settings fixes this, but its really annoying that its picking a different executable that isn't searching the same paths as the default :(
I had the same issue, and had to do the manual override suggested @repnop above (thanks!). Steps are actually quite simple:
- Specify the absolute path of your config file in the settings of Remote SSH extension
- Specify the absolute path of your OpenSSH ssh.exe executable in the settings of Remote SSH extension. For me the path was C:\Windows\System32\OpenSSH\ssh.exe
Had the exact same problem as well. The steps outlined by @intekhab8 above worked well for me.
The observation of @repnop seems correct. Switching the binary and specifically choosing the binary in C:\Windows\System32\OpenSSH\ssh.exe makes the is not recognized as an internal or external command messages go away. specifically choosing the binary in C:\Program Files\Git\usr\bin\ssh.exe brings the message back.
Unfortunately I do get a timeout with the ssh.exe from System32 (also when calling it from cmd). Will experiment a bit with the ssh timeout value within vs code.
I tried all the suggestion here and still not working
I have the same issue but with linux machine. Fix please?
All right I reference this issue I could not see this one so I created a new one which is exactly the same problem. I'm running Win10 on SB2. https://github.com/microsoft/vscode/issues/92644
The discussion above is correct (but it tries to avoid windows SSH due to a bug in the client) and I will find a fix for that however I think the issue here is something involving the space in the username, I will use this issue to track that specifically.
I am able to reproduce this issue on Windows 10, after the most recent update. Windows does have a space in my username "First Last". Downgrading to 0.49.0 fixes the issue.
Can confirm that this issue exists. With my username "Mitch Talmadge" on windows:
'C:\Users\Mitch' is not recognized as an internal or external command,
operable program or batch file.
Host key verification failed.
Switching to C:\Windows\System32\OpenSSH\ssh.exe as my ssh path fixed the problem.
reinstall "Remote-SSH" to version 0.48.0 solve my problem
My vscode stopped connecting to remote server and showed same error today. Reinstalling "Remote-SSH" to version 0.49.0 solved my problem. Latest version 0.50.0 caused this problem
I have been having issues with the upgrade and further to this, it looks like it is attempting to use the Windows username as the user in the ssh connection.
I looked at the auth.log file on my VM and found this:
Mar 19 18:01:10 dashboard sshd[28994]: Invalid user Lewis from 192.168.100.1 port 60612
Mar 19 18:01:10 dashboard sshd[28994]: Connection closed by invalid user Lewis 192.168.100.1 port 60612 [preauth]
In the extension output (in VSCode) for v0.50.0 it was attempting to connect as [email protected] instead of [email protected] which v0.49.0 of this extension was doing. The vagrant user was specified in my config.
Downgrading to v0.49.0 solved all my problems!
I believe this was fixed in https://github.com/microsoft/vscode-remote-release/issues/2406. Someone let me know if there is still an issue with whitespace in the username.