在 Windows 11 上使用 SSH 连接到远程服务器失败

问题描述 投票:0回答:1

我通过 VSCode 连接到 VM。

一开始还能正常连接,但是突然连接断开,报错。

enter image description here

[21:46:53.937] Log Level: 2
[21:46:53.945] SSH Resolver called for "ssh-remote+10.191.72.107", attempt 1
[21:46:53.945] "remote.SSH.useLocalServer": false
[21:46:53.945] "remote.SSH.useExecServer": false
[21:46:53.946] "remote.SSH.showLoginTerminal": true
[21:46:53.946] "remote.SSH.remotePlatform": {"10.191.72.107":"linux"}
[21:46:53.946] "remote.SSH.path": undefined
[21:46:53.946] "remote.SSH.configFile": undefined
[21:46:53.946] "remote.SSH.useFlock": true
[21:46:53.946] "remote.SSH.lockfilesInTmp": false
[21:46:53.946] "remote.SSH.localServerDownload": auto
[21:46:53.946] "remote.SSH.remoteServerListenOnSocket": false
[21:46:53.946] "remote.SSH.showLoginTerminal": true
[21:46:53.947] "remote.SSH.defaultExtensions": []
[21:46:53.947] "remote.SSH.loglevel": 2
[21:46:53.947] "remote.SSH.enableDynamicForwarding": true
[21:46:53.947] "remote.SSH.enableRemoteCommand": false
[21:46:53.947] "remote.SSH.serverPickPortsFromRange": {}
[21:46:53.950] "remote.SSH.serverInstallPath": {}
[21:46:53.953] VS Code version: 1.85.2
[21:46:53.953] Remote-SSH version: [email protected]
[21:46:53.953] win32 x64
[21:46:53.954] SSH Resolver called for host: 10.191.72.107
[21:46:53.954] Setting up SSH remote "10.191.72.107"
[21:46:53.957] Using commit id "8b3775030ed1a69b13e4f4c628c612102e30a681" and quality "stable" for server
[21:46:53.960] Install and start server if needed
[21:46:53.962] Checking ssh with "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\ssh.exe -V"
[21:46:53.964] Got error from ssh: spawn C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\ssh.exe ENOENT
[21:46:53.964] Checking ssh with "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp\ssh.exe -V"
[21:46:53.965] Got error from ssh: spawn C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\libnvvp\ssh.exe ENOENT
[21:46:53.965] Checking ssh with "D:\Develop\VMware\bin\ssh.exe -V"
[21:46:53.966] Got error from ssh: spawn D:\Develop\VMware\bin\ssh.exe ENOENT
[21:46:53.966] Checking ssh with "D:\Develop\nodejs\node_global\node_modules\ssh.exe -V"
[21:46:53.966] Got error from ssh: spawn D:\Develop\nodejs\node_global\node_modules\ssh.exe ENOENT
[21:46:53.966] Checking ssh with "D:\Develop\apache-maven-3.6.1\bin\ssh.exe -V"
[21:46:53.967] Got error from ssh: spawn D:\Develop\apache-maven-3.6.1\bin\ssh.exe ENOENT
[21:46:53.967] Checking ssh with "D:\chrome下载\snipaste\ssh.exe -V"
[21:46:53.968] Got error from ssh: spawn D:\chrome下载\snipaste\ssh.exe ENOENT
[21:46:53.968] Checking ssh with "C:\Program Files\Common Files\Oracle\Java\javapath\ssh.exe -V"
[21:46:53.969] Got error from ssh: spawn C:\Program Files\Common Files\Oracle\Java\javapath\ssh.exe ENOENT
[21:46:53.969] Checking ssh with "C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\ssh.exe -V"
[21:46:53.970] Got error from ssh: spawn C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\ssh.exe ENOENT
[21:46:53.970] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[21:46:53.971] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[21:46:53.971] Checking ssh with "C:\Windows\ssh.exe -V"
[21:46:53.972] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[21:46:53.972] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[21:46:53.972] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[21:46:53.973] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[21:46:53.973] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[21:46:53.973] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[21:46:54.006] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[21:46:54.010] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 58774 "10.191.72.107" bash
[21:46:54.012] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[21:47:15.394] > ssh: connect to host 10.191.72.107 port 22: Connection timed out
> ]0;C:\WINDOWS\System32\cmd.exe
[21:47:15.394] Got some output, clearing connection timeout
[21:47:15.411] > [8;16;50tssh: connect to host 10.191.72.107 port 22: Connection timed out
> 过程试图写入的管道不存在。
[21:47:16.665] "install" terminal command done
[21:47:16.665] Install terminal quit with output: 过程试图写入的管道不存在。
[21:47:16.665] Received install output: 过程试图写入的管道不存在。
[21:47:16.666] Failed to parse remote port from server output
[21:47:16.667] Resolver error: Error: 
    at g.Create (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:642703)
    at t.handleInstallOutput (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:640069)
    at t.tryInstall (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:761983)
    at async d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:722522
    at async t.withShowDetailsEvent (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:725828)
    at async I (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:719493)
    at async t.resolve (d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:723199)
    at async d:\Develop\VS Code\.vscode\extensions\ms-vscode-remote.remote-ssh-0.107.1\out\extension.js:2:907003
[21:47:16.671] ------
  1. 我尝试删除known_hosts文件,但仍然没有解决问题
  2. 我的配置是正确的
Host 00.00.00.00
  HostName 00.00.00.00
  User root
  Port 22

  1. 我尝试在 VS code 上打开命令面板(Windows 为 Ctrl+Shift+P,Mac 为 Cmd+Shift+P)。在主机上搜索 Kill VS Code Server,单击它并重新加载 VS Code 并重新建立连接。但还是没成功
ssh connection remote-server vscode-remote-ssh ssh-config
1个回答
0
投票

我通过下载回旧版本的 Vscode 解决了这个问题。 但还是不知道为什么突然断线了

© www.soinside.com 2019 - 2024. All rights reserved.