简体   繁体   中英

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. 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. Interesting fact is, that through terminal, I can easily connect with the command: 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. 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

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. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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