SSH with key passphrase not working

sshterminal

I am just trying to do a simple ssh into a VPS using the terminal. It asks for me to enter my passphrase three times then says "permission denied (public key)."

I've tried:

ssh -i [key location] user@xxx.xxx.xxx

I'm able to SFTP into the server in Cyberduck, and have also tried their 'Open in Terminal' command, which again just asks me for the passphrase three times then says permission denied.

I am able to connect using PuTTY in Windows, WinSCP and Cyberduck, so I am pretty sure I have the right key and passphrase. What am I missing here? I have a feeling it's something stupid, but I just can't figure it out.

Best Answer

PuTTY is using different key format than the OpenSSH and OpenSSH is failing to report correctly the errors about unknown format in some versions.

If you want to use the PuTTY key in OpenSSH, you need to convert the private key to OpenSSH format in PuTTYGen (as described on SO):

  • Open PuttyGen
  • Click Load
  • Load your private key
  • Go to Conversions->Export OpenSSH and export your private key
  • Copy your private key to ~/.ssh/id_rsa