SSH key asking me for a passphrase?

First off it's the private key that will have the pass-phrase. This validates against the public key stored on the remote server.

Best guess is that your are trying to use a putty private key (ppk) key format with openssh this doesn't work.... PuTTYgen has an export option for openssh if this is the case.

ssh-rsa AAAAB3NzaC1y...... etc

I also assume that the server you are trying to ssh to has your public key stored correctly in the authorized key file (in ~/.ssh/authorized_keys generally).

Another guess would be that the correct key isn't be selected. Some things I would try are:

Resetting the keys pass-phrase using ssh-keygen, like this...

$ ssh-keygen -f ~/.ec2/key.ppk -p

This will confirm if in fact your key does (or does not) have a pass-phrase on it already.

Secondly I'd try connecting using a verbose output, specifying your public key explicitly output:

$ ssh host -i ~/.ec2/key.ppk -vvv

This will give you more of an idea of what is going on.


You could run ssh-agent. See here for a discussion.

The short version that worked for me (in bash):

$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-rnRLi11880/agent.11880; export SSH_AUTH_SOCK;
SSH_AGENT_PID=11881; export SSH_AGENT_PID;
echo Agent pid 11881;

I took the 3 lines it echoes out, and executed them. Another way to do that is take the output of -s:

$ eval `ssh-agent -s`

Then I added my credentials to it:

$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/me/.ssh/id_rsa: 
Identity added: /home/me/.ssh/id_rsa (/home/me/.ssh/id_rsa)

Now the agent supplies the credentials instead of me having to type in my passphrase.

I believe ssh-agent goes away when the shell does, so this should be scripted upon startup for maximum convenience. The link I shared describes scripting as well.


Check that the private key id_rsa doesn't have extra line breaks at the end, in some cases extra line breaks will make ssh-keygen to ask for the passphrase, try this:

sed  '/^$/d' /path/to/key > id_rsa

test:

ssh-keygen -yf id_rsa