microsoft / microsoft/vscode-remote-release

Cannot connect to SSH daemon not named "sshd"

Open
#5,699 6 comments 4 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

feature-request ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Description

I am trying to connect via SSH to a remote Windows machine running a bitvise SSH server (process named "BvSshServer"). The extension fails to connect with the following error:

[08:32:35.376] > gps : Cannot find a process with the process identifier 1292.
> At line:9 char:6
> + if ((gps -Id $u_).Name -eq 'sshd') {
> +      ~~~~~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (1292:Int32) [Get-Process], Proc
>    essCommandException
>     + FullyQualifiedErrorId : NoProcessFoundForGivenId,Microsoft.PowerShell.Co
>    mmands.GetProcessCommand
> 
[08:32:35.465] > no sshd parent proc
Open for full log with some redactions.
[08:32:20.647] Log Level: 2
[08:32:20.651] remote-ssh@0.65.8
[08:32:20.652] win32 x64
[08:32:20.652] SSH Resolver called for "ssh-remote+myssh", attempt 1
[08:32:20.653] "remote.SSH.useLocalServer": false
[08:32:20.653] "remote.SSH.showLoginTerminal": true
[08:32:20.653] "remote.SSH.remotePlatform": {"<redacted hostname":"windows","<redacted hostname":"windows"}
[08:32:20.654] "remote.SSH.path": c:\\Program Files\\Git\\usr\\bin\\ssh.exe
[08:32:20.654] "remote.SSH.configFile": <redacted user dir>\.ssh\config
[08:32:20.654] "remote.SSH.useFlock": true
[08:32:20.654] "remote.SSH.lockfilesInTmp": false
[08:32:20.654] "remote.SSH.localServerDownload": auto
[08:32:20.655] "remote.SSH.remoteServerListenOnSocket": false
[08:32:20.655] "remote.SSH.showLoginTerminal": true
[08:32:20.655] "remote.SSH.defaultExtensions": []
[08:32:20.655] "remote.SSH.loglevel": 2
[08:32:20.655] SSH Resolver called for host: myssh
[08:32:20.655] Setting up SSH remote "myssh"
[08:32:20.671] Using commit id "7f6ab5485bbc008386c4386d08766667e155244e" and quality "stable" for server
[08:32:20.673] Install and start server if needed
[08:32:23.421] Checking ssh with "c:\\Program Files\\Git\\usr\\bin\\ssh.exe -V"
[08:32:23.470] > OpenSSH_8.7p1, OpenSSL 1.1.1k  25 Mar 2021

[08:32:23.475] Using SSH config file "<redacted user dir>\.ssh\config"
[08:32:23.476] Remote command length: 6017/8192 characters
[08:32:23.476] Running script with connection command: "c:\\Program Files\\Git\\usr\\bin\\ssh.exe" -T -D 57301 -F "<redacted user dir>\.ssh\config" myssh powershell
[08:32:23.480] Terminal shell path: C:\windows\System32\cmd.exe
[08:32:24.328] > ]0;C:\windows\System32\cmd.exe
[08:32:24.328] Got some output, clearing connection timeout
[08:32:24.340] > The authenticity of host '<redacted hostname> (<redacted ip>)' can't be established.
> DSA key fingerprint is <redacted fingerprint>.
> This key is not known by any other names
> Are you sure you want to continue connecting (yes/no/[fingerprint])?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[08:32:26.394] > y
[08:32:26.450] > e
[08:32:26.534] > s
[08:32:26.612] > 
[08:32:26.627] > Warning: Permanently added '<redacted hostname>' (DSA) to the list of known hosts.
[08:32:27.127] > <redacted username>@<redacted hostname>'s password: 
[08:32:29.878] > 
[08:32:30.267] > Windows PowerShell
> Copyright (C) 2016 Microsoft Corporation. All rights reserved.
[08:32:30.461] > PS <redacted user dir>> 
[08:32:30.487] > 
> PS <redacted user dir>> $uuid="8ef038346a38"
[08:32:30.512] > PS <redacted user dir>> "${uui
[08:32:30.518] > PS <redacted user dir>> "${uuid}: running"
> 8ef038346a38: running
> PS <redacted user dir>> "8ef038346a38: pauseLog"
> 8ef038346a38: pauseLog
[08:32:30.983] > 
[08:32:35.376] > gps : Cannot find a process with the process identifier 1292.
> At line:9 char:6
> + if ((gps -Id $u_).Name -eq 'sshd') {
> +      ~~~~~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (1292:Int32) [Get-Process], Proc
>    essCommandException
>     + FullyQualifiedErrorId : NoProcessFoundForGivenId,Microsoft.PowerShell.Co
>    mmands.GetProcessCommand
> 
[08:32:35.465] > no sshd parent proc
[08:32:36.807] "install" terminal command done
[08:32:36.808] Install terminal quit with output: no sshd parent proc
[08:32:36.808] Received install output: no sshd parent proc
[08:32:36.809] Failed to parse remote port from server output
[08:32:36.809] Resolver error: Error: 
	at Function.Create (<redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:397041)
	at Object.t.handleInstallOutput (<redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:395684)
	at Object.t.tryInstall (<redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:489314)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async <redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:453110
	at async Object.t.withShowDetailsEvent (<redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:456460)
	at async Object.t.resolve (<redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:454189)
	at async <redacted user dir>\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.8\out\extension.js:1:526942
[08:32:36.814] ------

The error occurs in the MS-defined function a_ as it seeks to find the SSH daemon PID by finding a parent process named sshd. When using bitvise's SSH server, there is no sshd process. Rather, the parent process during an SSH connection using bitvise are:

>powershell .\list_parent_procs.ps1
cmd
toterms
BvSshServer
services
wininit
Open for content of `.\list_parent_proces.ps1` .
function a_ {
    # get parent processes
    $t_ = $PID
    while ($True){
        $u_=(gcim win32_process | ? processid -eq $t_).ParentProcessId
        if (!$u_) {
            exit 0
        }
            $n_=(gps -Id $u_).Name
            "$n_"
            if ("$n_" -eq "wininit") {
                exit 0
            }
        $t_ = $u_
    }
}
a_

How can I connect to an SSH daemon not named sshd?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.