1

I got a new Windows computer and installed putty on it. I exported the registry keys from the old computer and imported them to recover the Putty connections and avoid adding them manually.

I also copied the rsa public key .ppk to the new computer and selected it in the Auth section in putty, but I get the following error:

Unable to use key file "c:\path\to\id_rsa.ppk" (unable to open file)

I'm temped to regenerate the key pair again in the VPS server but I thought public keys could be used by any computer!

Am I missing something? Any help is appreciated.

Thanks!

Edit:

Plink output (plink -v username@hostname -i "c:\path\to\id_rsa.ppk") as requested by @Martin Prikryl:

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

Edit 2:

putty.exe -v username@hostname -i "c:\path\to\id_rsa.ppk" throws a timeout error.

  • What do you get if you do `plink -v username@hostname -i "c:\path\to\id_rsa.ppk"`? – Martin Prikryl Dec 05 '18 at 15:28
  • Sorry I missed this comment. I get connection using your command, but I get weird characters. Does that have something to do with the shell? `]0;user@vpsxxxxx: ~user@vpsxxxxx:~$ ls google07fda122cca02bf8.html [0m[01;31msitepress-multilingual-cms.4.0.4.zip[0m [01;34mhtml[0m [01;34mthemeswp[0m ]0;user@vpsxxxxx: ~user@vpsxxxxx:~$ ]0;user@vpsxxxxx: ~user@vpsxxxxx:~$` – malcolmeggplant Dec 11 '18 at 19:12
  • I was interested in the authentication part of the output. The part you posted is irrelevant in the context of this question. – Martin Prikryl Dec 11 '18 at 20:49
  • My bad, there you go: `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` – malcolmeggplant Dec 14 '18 at 11:24
  • `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` – malcolmeggplant Dec 14 '18 at 11:24
  • Please edit this into your question. – Martin Prikryl Dec 14 '18 at 11:38
  • OK, so now, if you do the very same using PuTTY: `putty -v username@hostname -i "c:\path\to\id_rsa.ppk"` - What do you get in PuTTY event log? – Martin Prikryl Dec 14 '18 at 20:37
  • A putty window pops up in black and and after a while I get a timeout error. – malcolmeggplant Dec 18 '18 at 00:01
  • Oh sorry and event log is not written I don't understand why... I'm starting to think the issue has to do with importing the old machine's putty settings by exporting and importing the windows registry entries? Could this be causing the anomaly? – malcolmeggplant Dec 18 '18 at 00:12
  • So try to export/backup and delete everything in `HKCU/Software/SimonTatham/PuTTY/Sessions`. – Martin Prikryl Dec 18 '18 at 07:34

2 Answers2

0

It seems that you didn't "select" the key on the Connection > SSH > Auth page.

You have rather typed key name there only, without a path. So PuTTY cannot find it.

You need to use a full path to the key file, like C:\path\to\id_rsa.ppk.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
-1

Following this link:

You used Putty Private Key format (.ppk)
Convert your ppk to Openssh Key File (id_rsa)

And here is an explanation how to do it. Hope it helps.

pb772
  • 539
  • 1
  • 3
  • 14