我配置了免密设置(Windows利用ssh免密码登录Linux),git bash已经能够正常连接了,但是vscode还是不行,很奇怪。
VSCode报错信息:
[17:55:50.360] SSH Resolver called for "ssh-remote+106.52.2.19", attempt 5, (Reconnection)
[17:55:50.361] SSH Resolver called for host: 106.52.2.19
[17:55:50.361] Setting up SSH remote "106.52.2.19"
[17:55:50.363] Using commit id "da76f93349a72022ca4670c1b84860304616aaa2" and quality "stable" for server
[17:55:50.369] Install and start server if needed
[17:55:50.372] Using SSH config file "C:\Users\Administrator\.ssh\config"
[17:55:50.372] Running script with connection command: ssh -T -D 60062 -F "C:\Users\Administrator\.ssh\config" "106.52.2.19" bash
[17:55:50.376] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[17:55:50.722] > ]0;C:\WINDOWS\System32\cmd.exe
[17:55:50.722] Got some output, clearing connection timeout
[17:55:51.243] > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[17:55:51.264] > @ WARNING: UNPROTECTED PRIVATE KEY FILE! @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> Permissions for 'C:\\Users\\Administrator/.ssh/id_rsa_txy2' are too open.
> It is required that your private key files are NOT accessible by others.
> This private key will be ignored.
> Load key "C:\\Users\\Administrator/.ssh/id_rsa_txy2": bad permissions
> root@106.52.2.19: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pa
> ssword).
> 过程试图写入的管道不存在。
>
[17:55:52.547] "install" terminal command done
[17:55:52.548] Install terminal quit with output: 过程试图写入的管道不存在。
[17:55:52.548] Received install output: 过程试图写入的管道不存在。
[17:55:52.549] Failed to parse remote port from server output
[17:55:52.550] Resolver error: Error:
at Function.Create (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:585222)
at Object.t.handleInstallOutput (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:583874)
at Object.t.tryInstall (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:681023)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:643908
at async Object.t.withShowDetailsEvent (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:647224)
at async Object.t.resolve (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:644958)
at async c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.84.0\out\extension.js:1:727082
[17:55:52.552] ------
关键是下面这段,好像是秘钥文件没有权限,但是我查看属性,所有账号都有全权限。
找了篇文章说是不能继承权限,去掉(禁用继承)后还是无效。后面又找了个说是不能授权给其他账号,删除后,就可以了。(这个问题确实很奇怪,冒似管的有点宽了,正常都是有权限就行,还要看其他账号的权限,感觉很扯,具体是啥逻辑也不明白……)
[17:55:51.243] > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
[17:55:51.264] > @ WARNING: UNPROTECTED PRIVATE KEY FILE! @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> Permissions for 'C:\\Users\\Administrator/.ssh/id_rsa_txy2' are too open.
> It is required that your private key files are NOT accessible by others.
> This private key will be ignored.
> Load key "C:\\Users\\Administrator/.ssh/id_rsa_txy2": bad permissions
> root@106.52.2.19: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pa
> ssword).
> 过程试图写入的管道不存在。
一开始权限:
修改后:
参考:【服务器】SSH提示私钥:UNPROTECTED PRIVATE KEY FILE!: https://blog.csdn.net/qq_39441603/article/details/127695416