簡體   English   中英

無法從 Visual Studio Code 連接到 SSH 到特定服務器

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

我正在使用 Visual Studio Code,通過 SSH 連接和使用遠程服務器。我正在使用遠程資源管理器擴展。 它適用於所有服務器,除了一個不是真正的服務器; 它實際上是服務器,在其上運行 linux 發行版:entware。 有趣的是,通過終端,我可以輕松連接命令:ssh admin@router.asus.com。 連接已建立,我可以運行基本命令。 當我嘗試通過遠程資源管理器連接時,我無法連接。 Output 在下方。 知道可能是什么原因嗎?

[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] ------`

試圖通過 Visual Studio 連接

問題是 Visual Studio Code 不只是訪問 SSH 位置,VSC 所做的是當您 SSH 到一個位置時,它會在該位置安裝 Visual Studio Code Server ,然后通過 SSH 鏈接運行該安裝的版本。 我剛剛遇到了同樣的問題,並且在我意識到問題所在之前嘗試了幾次。

如果您在嘗試連接時注意到它,您會在右下角看到一個小祝酒詞,上面寫着類似Setting up SSH Host 192.168.1.1: (details) initializing VS Code Server ,它會要求您提供操作系統。 路由器本身無法運行 VS Code Server,所以連接失敗,不是因為 SSH 失敗,而是因為服務器設置失敗。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM