Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unable to use key file "...\id_rsa" (OpenSSH SSH-2 private key)" when authenticating with PuTTY [closed]

I have setup custom SSH keys on target Linux host2.

I'm able to passwordless ssh from Linux host1 to host2 using the below command.

ssh -i /app/misc/myssh_keys/my_id_rsa myuser@host2

I then copy the /app/misc/myssh_keys/my_id_rsa to my Windows location C:\putty\my_id_rsa

I then try to connect from Windows to Linux host2, but it prompts me for the password instead of passwordless login.

Below is my command:

C:\putty\putty.exe -ssh -i C:\putty\my_id_rsa myuser@host2

I'm getting the following output with the password prompt:

Unable to use key file "C:\putty\my_id_rsa" (OpenSSH SSH-2 private key)
Using username "myuser".
myhost@host2's password:

Below is the system details for Linux host2

uname -a
Linux host2 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 16 14:19:51 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux

Below is the system details for Windows host

C:\Users>systeminfo

Host Name:                 mywinhost
OS Name:                   Microsoft Windows 7 Professional
OS Version:                6.1.7601 Service Pack 1 Build 7601
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Member Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          hp
Registered Organization:   Hewlett-Packard Company
Product ID:                00321-OEM-8552671-07008
Original Install Date:     01-04-2017, 13:05:14
System Boot Time:          15-12-2019, 14:00:52
System Manufacturer:       HP
System Model:              HP 280 G2 MT (Legacy)
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~3700 Mhz
BIOS Version:              AMI A0.25, 06-02-2017

I read somewhere on Stack Overflow that I may have to convert the C:\putty\my_id_rsa key using PuTTYgen, but I would appreciate the exact commands and all the steps I would need to perform to get the ssh working.

Any other solution would also be appreciated.

like image 601
Ashar Avatar asked Dec 20 '19 07:12

Ashar


1 Answers

PuTTY cannot use keys in OpenSSH format.

You need to convert your key to .ppk format first. For that, use PuTTYgen from PuTTY package.

  • Run PuTTYgen;
  • Press Load to load the private key in OpenSSH format;
  • Press Save private key to save the private key in .ppk format
like image 98
Martin Prikryl Avatar answered Oct 21 '22 07:10

Martin Prikryl