【问题标题】:VSCode Remote SSH cannot identify private key fileVSCode Remote SSH 无法识别私钥文件
【发布时间】:2021-05-15 12:45:39
【问题描述】:

已经尝试解决这个问题好几个小时了。已经在网上搜索并按照教程进行操作,但没有任何效果。

在我的 Windows 本地机器上,我在 VSCode 中安装了 Remote SSH 插件。我正在尝试连接到我的远程 linux 服务器。

我的配置文件如下所示(将主机名和用户更改为虚拟值以确保安全)。

Host RemoteServer
    HostName remote.server.infra
    User user123
    IdentityFile ~/.ssh/privkey

尝试连接到新主机时。它一直提示输入密码。 根据检查日志说的是

no such identity: C:\\Users\\user123/.ssh/privkey: No such file or directory

这个私钥文件是我在连接远程服务器时在腻子中使用的确切文件。 我错过了什么?

编辑: 终于想通了。我必须使用 puttygen 将我的私钥转换为 openssh 格式。

【问题讨论】:

    标签: visual-studio-code ssh


    【解决方案1】:

    除了using an openSSH format,我还将完整路径放在配置文件中:

    Host RemoteServer
        HostName remote.server.infra
        User user123
        IdentityFile /c/Users/user123/.ssh/privkey
    

    请注意,SSH URL 随后变为:

    ssh -Tv RemoteServer
    

    注意:Başar Söker 添加 the comments

    我还需要在路径中添加一个冒号。
    如下所示:

     IdentityFile /c:/Users/username/.ssh/privatekey.pem
    

    【讨论】:

    • 我还需要在我的路径中添加一个冒号。这里的样子:/c:/Users/username/.ssh/privatekey.pem
    • @BaşarSöker 感谢您的反馈。我已将您的评论包含在答案中以获得更多可见性。
    猜你喜欢
    • 2019-05-05
    • 2020-12-24
    • 2022-01-14
    • 1970-01-01
    • 2017-03-03
    • 2013-08-12
    • 1970-01-01
    相关资源
    最近更新 更多