I'm on Mac OS X 10.9.5 and ssh agent is working just fine for two of my keys (include the main one, ~/.ssh/id_rsa). However, for my AWS key, it asks me for the passphase every time. I'm unsure why. I'd like for it to cache the AWS key until reboot like it does with the others.

When I run ssh-add -L I see id_rsa and the AWS key in the list. For some reason it only asks me for the id_rsa passphrase once after a reboot, but it asks me for the AWS passphrase every time I use it.

Edit: I've tried decrypting the key and then encrypting it again under a different name and the same thing happens.

I'm using ssh to connect to the server and I have the host configured in my .ssh/config.

Host aws
  HostName ec2-xxx-xxx-xxx-xxx.us-west-1.compute.amazonaws.com
  User ubuntu
  IdentityFile /Users/brent/.ssh/test2.pem
  IdentitiesOnly yes

Then the command I use to connect is ssh aws

I still get a ssh-agent window that pops up every time to get the key passphrase.

  • What command exactly are you using to ssh to AWS? – DerfK Jan 8 '15 at 1:57
  • Updated the question with the command I use. – Brent Jan 8 '15 at 2:31

Turns out that your private keys can't have a .pem extension. If I remove the extension from my private keys then they are successfully cached by ssh-agent.

It's also necessary to have a matching public key with the same name but with a .pub extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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