Skip to content

SSH Buggy on Windows #11792

Description

@JasonGoemaat

Is there an existing issue for this bug?

  • I have searched the existing open issues and found none that apply.
  • If I find any issue of interest that is related or closed, I will included a link to it in this issue.

Required Troubleshooting Steps

  • I have read and performed the troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
  • My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
  • I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar

[Optional] Diagnose with Copilot

I did not ask the @remote-ssh participant for help

In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?

I could NOT successfully SSH to the remote machine, and the error was DIFFERENT than what I saw in VS Code

Remote-SSH Log

It was a pain in the ass to go through the logs and figure out what the extension was even doing, looks like it searches through all the directories in my path to find ssh.exe. I have git and git bash using it's own, but also have Windows OpenSSH installed. VSCode seems to inherit the environment variables and such from whatever console started it so that's an extra layer of complexity. It would be nice if there was some logging or settings to make it easier to understand what was going on and what could be going wrong.

Anyway, I finally decided to go with the windows native ssh, so made sure C:\Windows\System32\OpenSSH was first in my path. The agent is running and has my key added, and typing this in a command prompt connects to my server without having to enter my key's password:

"C:\Windows\System32\OpenSSH\ssh.exe" jason@fedora

However this seems to be the command in the logs and it just sits there:

"C:\Windows\System32\OpenSSH\ssh.exe" -T -D 63123 fedora bash'

So when I start vscode from the command line, I go to open the remote, then after I click open folder and pick one I see the explorer populate with the subdirectories, so that seems to be working. In the Terminal tab of vscode I see TWO terminal sessions running, both say 'install Local' . The first looks hunky-dory and says "Found running server..." The second one asks me for my key's password. I don't know why that second one is even running though, I can edit files or whatever while it is just sitting there waiting for my key's password.

Remote-SSH Log

[18:51:46.573] Log Level: 2
[18:51:46.605] SSH Resolver called for "ssh-remote+fedora", attempt 1
[18:51:46.614] remote.SSH.useLocalServer = false
[18:51:46.614] remote.SSH.useExecServer = false
[18:51:46.614] remote.SSH.bindHost = {}
[18:51:46.614] remote.SSH.showLoginTerminal = true
[18:51:46.615] remote.SSH.remotePlatform = {"fedora":"linux"}
[18:51:46.615] remote.SSH.path = 
[18:51:46.615] remote.SSH.configFile = 
[18:51:46.615] remote.SSH.useFlock = true
[18:51:46.615] remote.SSH.lockfilesInTmp = false
[18:51:46.616] remote.SSH.localServerDownload = auto
[18:51:46.616] remote.SSH.remoteServerListenOnSocket = false
[18:51:46.616] remote.SSH.defaultExtensions = []
[18:51:46.616] remote.SSH.defaultExtensionsIfInstalledLocally = []
[18:51:46.616] remote.SSH.loglevel = 2
[18:51:46.617] remote.SSH.enableDynamicForwarding = true
[18:51:46.619] remote.SSH.enableRemoteCommand = false
[18:51:46.620] remote.SSH.serverPickPortsFromRange = {}
[18:51:46.620] remote.SSH.serverInstallPath = {}
[18:51:46.620] remote.SSH.permitPtyAllocation = false
[18:51:46.620] remote.SSH.preferredLocalPortRange = undefined
[18:51:46.620] remote.SSH.useCurlAndWgetConfigurationFiles = false
[18:51:46.620] remote.SSH.experimental.chat = true
[18:51:46.620] remote.SSH.experimental.enhancedSessionLogs = true
[18:51:46.620] remote.SSH.httpProxy = {"*":""}
[18:51:46.621] remote.SSH.httpsProxy = {"*":""}
[18:51:46.640] VS Code version: 1.133.0
[18:51:46.640] Remote-SSH version: remote-ssh@0.124.0
[18:51:46.640] win32 x64
[18:51:46.645] SSH Resolver called for host: fedora
[18:51:46.645] Setting up SSH remote "fedora"
[18:51:46.660] Using commit id "a5b500951314efd502d07465bd138dfbd714a960" and quality "stable" for server
[18:51:46.660] Extensions to install: 
[18:51:46.690] Install and start server if needed
[18:51:46.700] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[18:51:46.734] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

[18:51:46.743] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 63103 fedora bash
[18:51:46.745] Generated SSH command: 'type "C:\Users\Jason\AppData\Local\Temp\vscode-linux-multi-line-command-fedora-651874940.sh" | "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 63103 fedora bash'
[18:51:46.745] Using connect timeout of 17 seconds
[18:51:46.747] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[18:51:47.316] > 
[18:51:47.317] Got some output, clearing connection timeout
[18:51:47.330] > 
[18:51:47.358] > 
[18:51:47.866] > 6148121f1de3: running
[18:51:47.958] > Acquiring lock on /home/jason/.vscode-server/bin/a5b500951314efd502d07465bd138dfbd714a960/vscode-remote-lock.jason.a5b500951314efd502d07465bd138dfbd714a960
> Found existing installation at /home/jason/.vscode-server/bin/a5b500951314efd502d07465bd138dfbd714a960...
[18:51:48.002] > Checking /home/jason/.vscode-server/.a5b500951314efd502d07465bd138dfbd714a960.log and /home/jason/.vscode-server/.a5b500951314efd502d07465bd138dfbd714a960.pid for a running server
> Looking for server with pid: 3800430
> Found running server...
>  
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
> *
>  
> Checking server status on port 34713 with wget
> 6148121f1de3: start
> SSH_AUTH_SOCK==/tmp/ssh-XXXXffLVYe/agent.3802962==
> DISPLAY====
> webUiAccessToken====
> listeningOn==34713==
> osReleaseId==fedora==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> connectionToken==1a1a1a11-aa11-111a-111a-11a111111a11==
> 6148121f1de3: end
[18:51:48.003] Received install output: 
SSH_AUTH_SOCK==/tmp/ssh-XXXXffLVYe/agent.3802962==
DISPLAY====
webUiAccessToken====
listeningOn==34713==
osReleaseId==fedora==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==1a1a1a11-aa11-111a-111a-11a111111a11==

[18:51:48.007] Remote server is listening on port 34713
[18:51:48.008] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":34713},"osReleaseId":"fedora","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"/tmp/ssh-XXXXffLVYe/agent.3802962","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"1a1a1a11-aa11-111a-111a-11a111111a11"},"installUnpackCode":""}
[18:51:48.012] Starting forwarding server. local port 63112 -> socksPort 63103 -> remotePort 34713
[18:51:48.014] Forwarding server listening on port 63112
[18:51:48.014] Waiting for ssh tunnel to be ready
[18:51:48.019] Tunneled port 34713 to local port 63112
[18:51:48.019] Resolved "ssh-remote+fedora" to "port 63112"
[18:51:48.024] Updating $SSH_AUTH_SOCK: ln -f -s "/tmp/ssh-XXXXffLVYe/agent.3802962" "/run/user/1000/vscode-ssh-auth-sock-116956842"
[18:51:48.024] Using cwd: vscode-remote://ssh-remote%2Bfedora/
[18:51:48.024] Remote extension host environment: {"SSH_AUTH_SOCK":"/run/user/1000/vscode-ssh-auth-sock-116956842"}
[18:51:48.026] [Forwarding server port 63112] Got connection 0
[18:51:48.172] ------




[18:51:48.173] No hints found in the recent session.
[18:51:48.264] [Forwarding server port 63112] Got connection 1
[18:51:48.304] [Forwarding server port 63112] Got connection 2
[18:51:49.420] Opening exec server for ssh-remote+fedora
[18:51:49.439] Initizing new exec server for ssh-remote+fedora
[18:51:49.443] Using commit id "a5b500951314efd502d07465bd138dfbd714a960" and quality "stable" for server
[18:51:49.444] Extensions to install: 
[18:51:49.454] Install and start server if needed
[18:51:49.465] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 63123 fedora bash
[18:51:49.467] Generated SSH command: 'type "C:\Users\Jason\AppData\Local\Temp\vscode-linux-multi-line-command-fedora-225553580.sh" | "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 63123 fedora bash'
[18:51:49.467] Using connect timeout of 17 seconds
[18:51:49.468] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[18:51:49.798] > 
[18:51:49.799] Got some output, clearing connection timeout
[18:51:49.815] > 
[18:51:50.011] > Enter passphrase for key 'C:\Users\Jason/.ssh/id_rsa': 
[18:51:50.872] "Update SSH_AUTH_SOCK" terminal command done
[18:52:24.177] > 
[18:52:24.476] > 70b8c1cd5a51: running
> Script executing under PID: 3803230
> Found existing installation at /home/jason/.vscode-server...
[18:52:24.489] > Starting VS Code CLI...
> Removing old logfile at /home/jason/.vscode-server/.cli.a5b500951314efd502d07465bd138dfbd714a960.log
> Spawned remote CLI: 3803248
> Waiting for server log...
[18:52:24.527] > Waiting for server log...
[18:52:24.561] > 70b8c1cd5a51: start
> listeningOn==127.0.0.1:34849==
> osReleaseId==fedora==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==72==
> execServerToken==a1a11a11-1a11-111a-aa11-a1111a11a11a==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> 70b8c1cd5a51: end
[18:52:24.562] Received install output: 
listeningOn==127.0.0.1:34849==
osReleaseId==fedora==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==72==
execServerToken==a1a11a11-1a11-111a-aa11-a1111a11a11a==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====

[18:52:24.564] Remote server is listening on port 34849
[18:52:24.564] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":34849},"osReleaseId":"fedora","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","execServerToken":"a1a11a11-1a11-111a-aa11-a1111a11a11a"},"serverStartTime":72,"installUnpackCode":""}
[18:52:24.575] Starting forwarding server. local port 63128 -> socksPort 63123 -> remotePort 34849
[18:52:24.577] Forwarding server listening on port 63128
[18:52:24.578] Waiting for ssh tunnel to be ready
[18:52:24.580] Tunneled port 34849 to local port 63128
[18:52:24.581] Resolved "ssh-remote+fedora" to "port 63128"
[18:52:24.581] Resolving exec server at port 63128
[18:52:24.584] [Forwarding server port 63128] Got connection 0
[18:52:24.596] [Forwarding server port 63128] Got connection 1
[18:52:24.664] Exec server for ssh-remote+fedora created and cached
[18:52:24.664] No hints found in the recent session.
[18:52:24.675] Opening exec server for ssh-remote+fedora
[18:52:24.693] Verified and reusing cached exec server for ssh-remote+fedora
[18:52:24.694] No hints found in the recent session.

Expected Behavior

I expect it to be able to connect just like the ssh.exe executable does from the command line and not ask my for my key's password.

Actual Behavior

It's weird, I don't understand exactly what's happening on each and every occassion. There are multiple terminals saying 'install Local', the first seems to have connected fine and the second is asking me for the passphrase for my private key.

Steps To Reproduce

  1. Windows with Windows OpenSSH (C:\Windows\System32\OpenSSH\ssh.exe)
  2. Key added to agent

Anything else?

No response

Metadata

Metadata

Assignees

Labels

sshIssue in vscode-remote SSH

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions