[英]Connecting to remote linux server with VSCode through WSL - File location issue?
当尝试使用 VS Code / WSL 远程访问作为 Digital Ocean 液滴托管的 linux 服务器时,我们收到此错误:
[17:38:24.258] Log Level: 2
[17:38:24.260] remote-ssh@0.63.0
[17:38:24.260] win32 x64
[17:38:24.262] SSH Resolver called for "ssh-remote+100.100.10.100", attempt 1
[17:38:24.263] "remote.SSH.useLocalServer": false
[17:38:24.263] "remote.SSH.showLoginTerminal": false
[17:38:24.263] "remote.SSH.remotePlatform": {"$remote_server_name":"linux"}
[17:38:24.264] "remote.SSH.sshPath": undefined
[17:38:24.264] "remote.SSH.sshConfigurationFile": undefined
[17:38:24.264] "remote.SSH.useFlock": true
[17:38:24.265] "remote.SSH.lockfilesInTmp": false
[17:38:24.265] "remote.SSH.localServerDownload": auto
[17:38:24.265] "remote.SSH.remoteServerListenOnSocket": false
[17:38:24.265] "remote.SSH.showLoginTerminal": false
[17:38:24.266] SSH Resolver called for host: 100.100.10.100
[17:38:24.266] Setting up SSH remote "100.100.10.100"
[17:38:24.278] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d8c0523" and quality "stable" for server
[17:38:24.285] Install and start server if needed
[17:38:25.556] Checking ssh with "ssh -V"
[17:38:25.713] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[17:38:25.726] Running script with connection command: ssh -T -D 53538 "100.100.10.100" bash
[17:38:25.735] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[17:38:26.931] > no such identity: /home/user/.ssh/id_rsa: No such file or directory
> ]0;C:\WINDOWS\System32\cmd.exe
[17:38:26.933] Got some output, clearing connection timeout
[17:38:26.940] > root@100.100.10.100: Permission denied (publickey).
> The process tried to write to a nonexistent pipe.
据我所知,问题在于
[17:38:26.931] > no such identity: /home/user/.ssh/id_rsa: No such file or directory
然而
ssh -vv root@100.100.10.100 -i /home/user/.ssh/id_rsa
在调试中连接成功并访问服务器
debug1: Authentication succeeded (publickey).
因此,在 VS Code 的配置文件中指定id_rsa
的位置一定是个问题。
Host 100.100.10.100
HostName 100.100.10.100
User root
ForwardAgent yes
IdentityFile /home/autosermo/.ssh/id_rsa
我们已经尝试了所有我们能想到的IdentityFile
值(... ~/.ssh/id_rsa
等),但无法确定。
这里还有哪些其他可能的位置/应该为IdentityFile
提供什么路径?
谢谢
WSL 在这里有点红鲱鱼。 当你在 VSCode 中使用“ Remote - SSH ”扩展时,你根本不会通过 WSL。 从 output 中的这一行可以看出...
[17:38:25.713] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
...它对 Windows 使用 OpenSSH。
您的私钥在 OpenSSH 中的位置应该是%userprofile%/.ssh
(类似于C:\Users\username\.ssh
) 试着把它放在那里。 还尝试从 PowerShell 或 cmd 而不是 WSL 执行ssh
命令,因为这是 VSCode 使用的命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.