4

I am attempting to connect to my local windows machine via ssh on VSCode.

It connects instantly from the CLI directly:

➜  ~ ssh windows
johnpc@DESKTOP-U5QAQJ4 MINGW64 ~
$ ls
# my windows files appear

The windows host is configured in my ssh config as follows:

Host windows
    HostName 192.168.7.208
    User johnpc
    IdentityFile ~/.ssh/id_rsa

However, when I attempt to connect to this host using the Remote-SSH VSCode extension, I get the following output, followed by a "connection timed out" error.

[12:14:05.084] Log Level: 2
[12:14:05.086] [email protected]
[12:14:05.086] darwin x64
[12:14:05.087] SSH Resolver called for "ssh-remote+windows", attempt 1
[12:14:05.088] "remote.SSH.useLocalServer": true
[12:14:05.088] "remote.SSH.path": undefined
[12:14:05.088] "remote.SSH.configFile": undefined
[12:14:05.089] "remote.SSH.useFlock": true
[12:14:05.089] "remote.SSH.lockfilesInTmp": false
[12:14:05.089] "remote.SSH.localServerDownload": auto
[12:14:05.089] "remote.SSH.remoteServerListenOnSocket": false
[12:14:05.089] "remote.SSH.showLoginTerminal": false
[12:14:05.090] "remote.SSH.defaultExtensions": []
[12:14:05.090] "remote.SSH.loglevel": 2
[12:14:05.090] SSH Resolver called for host: windows
[12:14:05.090] Setting up SSH remote "windows"
[12:14:05.094] Acquiring local install lock: /var/folders/33/_y9rjvqs5qb_9kqnjkdsqmn00000gr/T/vscode-remote-ssh-d59726ea-install.lock
[12:14:05.097] Looking for existing server data file at /Users/xss/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-7f6ab5485bbc008386c4386d08766667e155244e-0.65.8/data.json
[12:14:05.099] Using commit id "7f6ab5485bbc008386c4386d08766667e155244e" and quality "stable" for server
[12:14:05.103] Install and start server if needed
[12:14:05.112] PATH: /usr/bin:/bin:/usr/sbin:/sbin
[12:14:05.113] Checking ssh with "ssh -V"
[12:14:05.122] > OpenSSH_8.1p1, LibreSSL 2.7.3

[12:14:05.135] askpass server listening on /var/folders/33/_y9rjvqs5qb_9kqnjkdsqmn00000gr/T/vscode-ssh-askpass-7c5258e395d834dd29687f462a9d8b0f6991a74c.sock
[12:14:05.152] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/33/_y9rjvqs5qb_9kqnjkdsqmn00000gr/T/vscode-ssh-askpass-0574ebf0bc7748cd079f9c7446cf741428682ad7.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","49840","-o","ConnectTimeout=15","windows"],"dataFilePath":"/Users/xss/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-7f6ab5485bbc008386c4386d08766667e155244e-0.65.8/data.json"}
[12:14:05.152] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/xss/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.8/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer)","VSCODE_SSH_ASKPASS_MAIN":"/Users/xss/.vscode/extensions/ms-vscode-remote.remote-ssh-0.65.8/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/33/_y9rjvqs5qb_9kqnjkdsqmn00000gr/T/vscode-ssh-askpass-7c5258e395d834dd29687f462a9d8b0f6991a74c.sock"}
[12:14:05.155] Spawned 50798
[12:14:05.280] > local-server-1> Spawned ssh, pid=50799
[12:14:05.298] stderr> OpenSSH_8.1p1, LibreSSL 2.7.3
[12:14:05.696] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:de8MMkFj9OesKnoJGzuHZlBRw9BfkLCD2Rvpn2jtY6g
[12:14:06.104] stderr> Authenticated to 192.168.7.208 ([192.168.7.208]:22).
[12:14:06.490] > ready: f87615babce1
[12:14:06.591] > MINGW64_NT-10.0-19042 3.1.7-340.x86_64 2021-03-26 22:17 UTC

screenshot of connection timeout

Any ideas what might be going on? Feels especially weird because the messages look like everything is succeeded, but still emit as stderr? stderr> Authenticated?

2 Answers 2

3

I figured it out (kind of). Remote-SSH only seems to work if Powershell is configured as the default ssh shell in windows.

On the windows machine, I had to run:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

Previously, I had been using git-bash as the default terminal (which is what I'd prefer):

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Prog
ram Files\Git\bin\bash.exe" -PropertyType String -Force

Now every time I log in I have to run & 'C:\Program Files\Git\bin\bash.exe' to reach the git-bash shell.

Sign up to request clarification or add additional context in comments.

Comments

0

Have you checked your Firewall/Antivirus?

A Timeout would appear if there is no answer, even if local. (Please be carefull if you want to disable your Firewall complete for testing.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.