首页 > 解决方案 > 新 Windows 机器上的 Putty 和 rsa 公钥错误

问题描述

我买了一台新的 Windows 电脑并在上面安装了 putty。我从旧计算机导出注册表项并导入它们以恢复 Putty 连接并避免手动添加它们。

我还将 rsa 公钥 .ppk 复制到新计算机并在 putty 的 Auth 部分中选择它,但出现以下错误:

无法使用密钥文件“c:\path\to\id_rsa.ppk”(无法打开文件)

我很想在 VPS 服务器中重新生成密钥对,但我认为任何计算机都可以使用公钥!

我错过了什么吗?任何帮助表示赞赏。

谢谢!

编辑:

根据@Martin Prikryl 的要求,Plink 输出(plink -v username@hostname -i "c:\path\to\id_rsa.ppk"):

We claim version: SSH-2.0-PuTTY_Release_0.70 Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1 Using SSH protocol version 2 Doing ECDH key exchange with curve Curve25519 and hash SHA-256 Server also has ssh-ed25519/ecdsa-sha2-nistp256 host keys, but we don't know any of them Host key fingerprint is: ssh-rsa 2048 24:2a:c3:65:b9:9a:3e:5f:59:fc:dc:15:42:31:0b:a0 Initialised AES-256 SDCTR client->server encryption Initialised HMAC-SHA-256 client->server MAC algorithm Initialised AES-256 SDCTR server->client encryption Initialised HMAC-SHA-256 server->client MAC algorithm Reading key file "D:\path\to\id_rsa.ppk" Using username "user". Offered public key Offer of public key accepted Authenticating with public key "imported-openssh-key" Sent public key signature Access granted Opening session as main channel Opened main channel Allocated pty (ospeed 38400bps, ispeed 38400bps) Started a shell/command

编辑2:

putty.exe -v username@hostname -i "c:\path\to\id_rsa.ppk" 抛出超时错误。

标签: rsaputty

解决方案


您似乎没有在Connection > SSH > Auth页面上“选择”密钥。

您只在此处输入了键名,没有路径。所以 PuTTY 找不到它。

您需要使用密钥文件的完整路径,例如C:\path\to\id_rsa.ppk.


推荐阅读