21

What have I done:
I'm trying to connect to my remote server with private key with

ssh -i privkey.ppk root@ip

But it's returning an error.
Error message:

Load key "privkey.ppk": invalid format
root@ip: Permission denied (publickey).

Expected result:
I should be able to login into my remote server with ssh key.

Key file content:

PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20181019
Public-Lines: 6
some lines
Private-Lines: 14
some lines
Private-MAC: some letters

OS: Ubuntu 18.04

(p.s:

  1. I'm using the same key in putty, termius to login into my remote server and its working fine
  2. Ansible ping cmd also returning the same result)

2 Answers 2

32

This key is generated by PuTTYgen software. To use it in linux you should start PuTTYgen, load the key (File->Load private key) and then export it as OpenSSH key ( Conversions->Export OpenSSH key)

3
  • Can it be done on a Macbook? Jun 13 at 13:47
  • @MemphisMeng, you have ssh client on MacOS, why you will need Putty? Jun 13 at 14:02
  • Never mind, it was just a silly question after I figured that I should ask for the passphrase. Jun 14 at 14:45
16

My PPK was in putty PPK format I had to convert into OpenSSH format.
I converted .ppk to OpenSSH using this answer, now I'm able to connect.

puttygen id_dsa.ppk -O public-openssh -o id_dsa.pub
1
  • For me, i was convert it to "pem" format instead of "pub" format and it's work. puttygen id_dsa.ppk -O private-openssh -o id_dsa.pem. Hope it's help some one.
    – fudu
    Jun 13 at 6:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .