At work, I use windows machines. Recently I generated a key-pair using PuttyGen in Windows, it worked fine when I connected to my remote server using Putty (Of course with my public key stored on the remote server first).
However I got troubled when was trying to use this same private key I obtained from PuttyGen with ssh command from Linux machine. My key-pair does not use password, however when I connect from Linux terminal I was asked for passphrase for my key:
Enter passphrase for key 'XXX.ppk'
I was also asked for the password for the server, however my server does not have a password either, so I was receiving:
Permission denied, please try again.
So I figure there must be some potential issue with the key exception I did not know what the problem was exactly. Initially I thought the key might be OS dependent (since I generated in windows), it proved that I was wrong after I tried the key in windows with ssh command. I was receiving different error:
Load key "XXX.ppk": invalid format
I was troubled how could the key be invalid. Some research and googling with keywords, private key works with putty but not ssh command, directed me to the right answer.
Putty uses a nonstandard format for its private keys. We need to load the key again and covert it to the standard OpenSSH format.
To do that:
- open PuttyGen in windows
- Load the private key
- click on conversion menu
- choose “export OpenSSH key”
- save the key and use this new key with ssh command