2

A lot of topics seems to be related to my issue. But none of them solved my problem:

I have copied my SSH private key to a new server. I have never set a passphrase for it. But now when I try to connect to Gitlab (from my server) it asks for a password.

ssh -v -i /home/john/.ssh/id_rsa [email protected]
[...]
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/john/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: key_parse_private2: missing begin marker
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/john/.ssh/id_rsa': 

If I create a brand new pair of keys. It perfectly works! But I want to keep my current key. On the client side, the rights are good: - .ssh -> 700 - id_rsa -> 600

I am running a fresh Centos 7.3.

1 Answer 1

3

Your private key is presumably not in the exact format that SSH requires. Make sure that it begins with -----BEGIN RSA PRIVATE KEY----- and ends with -----END RSA PRIVATE KEY----- exactly.

2
  • 1
    When I saw your answer, I told myself "How this man can say something stupid like this?". Well, I was the stupid man :D My private key file missed the "-----END RSA PRIVATE KEY-----" part. Thanks a lot man!
    – Mr.King
    May 1, 2017 at 19:58
  • If I could say unbelievable and incredible in 10 different languages, I would. I had the exact same problem and it has been annoying me for YEARS. Tacking on the -----END RSA PRIVATE KEY----- closing stanza made it go away immediately!
    – D. Woods
    Oct 3, 2018 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.