2

I'm trying to use ssh to log in to AWS from OSX Mavericks and having a hell of a time. I enter:

ssh -i ~/.ssh/filename.pem
[email protected] -v

And I get this, as well as a keychain popup that asks for a password, even though there is none to give...

debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Saving password to keychain failed.

I launched a new instance on AWS and generated a new key pair. When I left the .pem file unprotected, the OSX keychain popup didn't appear, but I was unable to access AWS because the file was unprotected:

Permissions 0644 for '/Users/cvn/.ssh/chris-test.pem' are too open.

It is required that your private key files are NOT accessible by

others. This private key will be ignored. bad permissions: ignore

key: /Users/cvn/.ssh/chris-test.pem Permission denied (publickey).

So I ran

chmod 400 chris-test.pem

and the Keychain returned asking for a password that I do not have...

2
  • Sounds like the format of your pem file is wrong. Check that you've got all of the required content. Running SSH with debug switches might give a clue (-d -d-d) Jun 9, 2015 at 6:39
  • did you ever figure this out? same issue...
    – ambe5960
    Nov 10, 2015 at 22:21

3 Answers 3

6

In my case private key was in openssh format (line -----BEGIN OPENSSH PRIVATE KEY----- in key file to check), but client ssh works only with rsa format (-----BEGIN RSA PRIVATE KEY----- line). I'd just converted one to another and it works. See how to convert Openssh Private Key to RSA Private Key here.

1

Make sure you're really using private key (not a public one, not something else) and double-check its content.

2
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – Dave M
    Mar 29, 2017 at 21:32
  • @DaveM now it's better?
    – Putnik
    Mar 30, 2017 at 18:44
0

In my case, removing the line IdentitiesOnly=yes from my ~/.ssh/config file solved the issue.

You must log in to answer this question.

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