2

On running the command ssh-add mykey.ppk it asks for passphrase:

Enter passphrase for mykey.ppk:

But I can see that the key does not have any passphrase and is not encrypted

$ head mykey.ppk
PuTTY-User-Key-File-2: ssh-rsa
Encryption: none
Comment: imported-openssh-key
Public-Lines: 6
AAAAB3NzaC1yc2EAAAADAQABAAABAQC8V+PLuklXrfFDZ9GNluXB/L8foOzaEp5s
jwaOL1iAxCKDWWsfsmyj9MbhV5r4Z6VGo/0T

Simply pressing enter at the prompt does not work. How can I add this key to the agent?

PS: I've already heard the sermon on security practices, so you can save your breath :-)

Kshitiz Sharma
  • 8,585
  • 21
  • 59
  • 75
  • Did you just cat your private key to the entire internet? – Canadian Luke Nov 13 '16 at 19:02
  • I never seen that file format outputted, so I don't know. So, that's why I'm asking – Canadian Luke Nov 13 '16 at 19:16
  • @TeroKilkanen I would think so, that looks very short for an RSA key. – user253751 Nov 13 '16 at 23:27
  • 1
    Relax guys. This is a putty key where the first section of the file is public key and length is 2048 bits. What you're seeing is a truncated public key. Its more of a `head` of the file than a full `cat` – Kshitiz Sharma Nov 13 '16 at 23:45
  • See http://unix.stackexchange.com/questions/74545/what-difference-between-openssh-key-and-putty-key and cross-stack http://superuser.com/questions/990275/generate-rsa2-key-in-openssh-format and http://superuser.com/questions/989826/generate-rsav2-key-in-openssh-format-in-windows – dave_thompson_085 Nov 14 '16 at 12:37

1 Answers1

9

ssh-agent does not support private keys in PPK format (PuTTY). You need to convert the key to OpenSSH key using PuTTY gen to be able to add it to your ssh-agent.

Related question on RaspberryPi.

These steps are needed:

  • Load your private key into PuTTYgen
  • Go to Conversions → Export OpenSSH and export your key as mykey.key
  • Add your key to your agent using ssh-add mykey.key.

On Linux, the equivalent puttygen command is:

puttygen mykey.ppk -o mykey.key -O private-openssh
Jakuje
  • 20,974
  • 7
  • 51
  • 70