简体   繁体   English

无法从 Visual Studio Code 连接到 SSH 到特定服务器

[英]Unable to connect to SSH from Visual Studio Code to particular server

I am using Visual Studio Code, for connecting and working with remote servers through SSH. I am using remote Explorer extension.我正在使用 Visual Studio Code,通过 SSH 连接和使用远程服务器。我正在使用远程资源管理器扩展。 It is working fine for all servers, except one, which is not a real server;它适用于所有服务器,除了一个不是真正的服务器; it is in fact server, that is running linux distribution on it: entware.它实际上是服务器,在其上运行 linux 发行版:entware。 Interesting fact is, that through terminal, I can easily connect with the command: ssh admin@router.asus.com.有趣的是,通过终端,我可以轻松连接命令:ssh admin@router.asus.com。 Connection is established and I can run basic commands.连接已建立,我可以运行基本命令。 While I am trying to connect through remote explorer, I am not able to connect.当我尝试通过远程资源管理器连接时,我无法连接。 Output is bellow. Output 在下方。 Any idea what might be the reason?知道可能是什么原因吗?

[09:44:34.076] Log Level: 2
[09:44:34.088] remote-ssh@0.92.0
[09:44:34.088] win32 x64
[09:44:34.103] SSH Resolver called for "ssh-remote+router.asus.com", attempt 1
[09:44:34.104] "remote.SSH.useLocalServer": false
[09:44:34.104] "remote.SSH.showLoginTerminal": false
[09:44:34.105] "remote.SSH.path": undefined
[09:44:34.105] "remote.SSH.configFile": undefined
[09:44:34.105] "remote.SSH.useFlock": true
[09:44:34.105] "remote.SSH.lockfilesInTmp": false
[09:44:34.105] "remote.SSH.localServerDownload": auto
[09:44:34.105] "remote.SSH.remoteServerListenOnSocket": false
[09:44:34.106] "remote.SSH.showLoginTerminal": false
[09:44:34.106] "remote.SSH.defaultExtensions": []
[09:44:34.106] "remote.SSH.loglevel": 2
[09:44:34.106] "remote.SSH.enableDynamicForwarding": true
[09:44:34.106] "remote.SSH.enableRemoteCommand": false
[09:44:34.106] "remote.SSH.serverPickPortsFromRange": {}
[09:44:34.107] "remote.SSH.serverInstallPath": {}
[09:44:34.111] SSH Resolver called for host: router.asus.com
[09:44:34.111] Setting up SSH remote "router.asus.com"
[09:44:34.123] Using commit id "6261075646f055b99068d3688932416f2346dd3b" and quality "stable" for server
[09:44:34.131] Install and start server if needed
[09:44:35.753] Checking ssh with "ssh -V"
[09:44:35.855] > O
[09:44:35.856] > penSSH_for_Windows_8.6p1, LibreSSL 3.4.3

[09:44:35.870] Running script with connection command: ssh -T -D 56215 "router.asus.com" bash
[09:44:35.874] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[09:44:36.933] > admin@router.asus.com's password:�]0;C:\WINDOWS\System32\cmd.exe�
[09:44:36.933] Got some output, clearing connection timeout
[09:44:36.933] Showing password prompt
[09:44:41.224] Got password response
[09:44:41.224] "install" wrote data to terminal: "************"
[09:44:41.272] >
[09:44:41.568] > Permission denied, please try again.

admin@router.asus.com's password:
[09:44:41.568] Showing password prompt
[09:44:47.877] Got password response
[09:44:47.877] "install" wrote data to terminal: "***********"
[09:44:47.917] >
[09:44:47.947] > 685b207502bc: running
[09:44:47.961] > bash: syntax error: unexpected "(" (expecting "then")
[09:44:49.237] "install" terminal command done
[09:44:49.238] Install terminal quit with output: bash: syntax error: unexpected "(" (expecting "then")
[09:44:49.238] Received install output: bash: syntax error: unexpected "(" (expecting "then")
[09:44:49.239] Failed to parse remote port from server output
[09:44:49.241] Resolver error: Error:
at g.Create (c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:583821)
at t.handleInstallOutput (c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:582473)
at t.tryInstall (c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:679811)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:642614
at async t.withShowDetailsEvent (c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:645932)
at async t.resolve (c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:643664)
at async c:\Users\rorogelj.vscode\extensions\ms-vscode-remote.remote-ssh-0.92.0\out\extension.js:1:722342
[09:44:49.251] ------`

Tried to connects through Visual Studio试图通过 Visual Studio 连接

The problem is that Visual Studio Code doesn't just access SSH locations, what VSC does is when you SSH into a location it installs Visual Studio Code Server on that location & then runs that installed version through the SSH link.问题是 Visual Studio Code 不只是访问 SSH 位置,VSC 所做的是当您 SSH 到一个位置时,它会在该位置安装 Visual Studio Code Server ,然后通过 SSH 链接运行该安装的版本。 I just went through the same problem & it was a few tries before I realized what the problem was.我刚刚遇到了同样的问题,并且在我意识到问题所在之前尝试了几次。

If you notice when it's attempting to connect you will see a little toast in the bottom right that says something along the lines of Setting up SSH Host 192.168.1.1: (details) initializing VS Code Server & it will ask you for the OS.如果您在尝试连接时注意到它,您会在右下角看到一个小祝酒词,上面写着类似Setting up SSH Host 192.168.1.1: (details) initializing VS Code Server ,它会要求您提供操作系统。 The router cannot run the VS Code Server itself, so the connection fails, not because the SSH fails, but because the server failed to be setup.路由器本身无法运行 VS Code Server,所以连接失败,不是因为 SSH 失败,而是因为服务器设置失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM