【发布时间】:2022-01-25 00:20:22
【问题描述】:
我正在尝试使用 VS Code 连接虚拟机 (Linux)。 尝试使用 VS 代码登录时出现权限被拒绝错误。
日志-
[15:13:47.479] Log Level: 2
[15:13:47.488] remote-ssh@0.70.0
[15:13:47.488] win32 x64
[15:13:47.491] SSH Resolver called for "ssh-remote+<...>.com", attempt 1
[15:13:47.493] "remote.SSH.useLocalServer": false
[15:13:47.493] "remote.SSH.showLoginTerminal": false
[15:13:47.493] "remote.SSH.remotePlatform": {}
[15:13:47.493] "remote.SSH.path": undefined
[15:13:47.494] "remote.SSH.configFile": undefined
[15:13:47.494] "remote.SSH.useFlock": true
[15:13:47.494] "remote.SSH.lockfilesInTmp": false
[15:13:47.494] "remote.SSH.localServerDownload": auto
[15:13:47.494] "remote.SSH.remoteServerListenOnSocket": false
[15:13:47.495] "remote.SSH.showLoginTerminal": false
[15:13:47.495] "remote.SSH.defaultExtensions": []
[15:13:47.495] "remote.SSH.loglevel": 2
[15:13:47.495] "remote.SSH.serverPickPortsFromRange": {}
[15:13:47.495] "remote.SSH.enableDynamicForwarding": true
[15:13:47.496] "remote.SSH.serverInstallPath": {}
[15:13:47.498] SSH Resolver called for host: <...>.com
[15:13:47.498] Setting up SSH remote "<...>.com"
[15:13:47.536] Using commit id "899d46d82c4c95423fb7e10e68eba52050e30ba3" and quality "stable" for server
[15:13:47.544] Install and start server if needed
[15:13:52.096] Checking ssh with "ssh -V"
[15:13:52.200] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[15:13:52.208] Running script with connection command: ssh -T -D 49695 "<...>.com" bash
[15:13:52.214] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[15:14:16.296] > no such identity: <...>.pem: No such file or directory
> ]0;C:\WINDOWS\System32\cmd.exeno such identity: <...>.pem: No such file or directory
> <....>.com: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
配置文件-
Host <...>
HostName <....>
IdentityFile <...>.pem
User <..>
将 pem 文件移至 .ssh 目录
PS C:\Users\HP\.ssh> ls
Directory: C:\Users\HP\.ssh
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 8/30/2021 10:41 AM 1675 <...>.pem
-a---- 12/24/2021 3:34 PM 91 config
我可以使用 PowerShell 或 putty 连接到 VM,但无法使用 VS Code 连接。
【问题讨论】: