Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a public/private key pair. Neither of them have any sort of passphrase associated with them.

Whenever I try to ssh using either the private or public(and I'm pretty sure I should only be using the public key), I get queried for a passphrase, and then of course can't connect up.

Anyone have any idea how to get around this? Am I typing some command incorretly? I am trying to ssh into a server that I have setup in my ~/.ssh/config file(correctly, since this exact same setup works on another server) with the key stored in ~/.ec2/key.ppk

I've also tried using puttygen.exe to generate a new private key WITH a passphrase, and then using that key, and when I type the passphrase, it still fails.

share|improve this question

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.

share|improve this answer
Correct, this is a key generated by puttygen from a key that works in putty. When I putty into the same server(from the machine that hosts the cygwin instance) it works fine with the exact same key. When i try to connect via ssh from cygwin, it bombs out. I'm confused how to make this work. – llaskin Jun 25 '10 at 13:38
I think mrverrall's points is that the file format for the PuTTY private key is not the same as the file format used for OpenSSH (the ssh client in cygwin). So OpenSSH is just failing to use the private key data because it can't figure out what the data means. But PuTTY has an "export" option, so you can get data in the "PEM" format needed. – Phil P Jan 23 '11 at 21:44
This error also is given if the file is in correct format - so double and triple check you copied and pasted properly if manually creating it. – Daniel Sokolowski Sep 3 '15 at 19:40

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;
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.

share|improve this answer

When you set up your public key, you probably (perhaps inadvertently) set it up with a passphrase.

You probably need to start fresh -- I haven't used puttygen, but you can delete (or rename) the public key in your .ssh directory, use ssh-keygen to generate a new one (being sure not to provide a passphrase), and then share the public_key out to the authorized_keys file on the server you're trying to connect to.

You may need to also remove your old passphrase-key from the authorized-keys file on the server you're connecting to.

share|improve this answer

One thing to check, if your sshd_config file has StrictModes=yes , then the $HOME directory or $HOME/.ssh directory must not be world writable to group or other. Otherwise authentication fails no matter what.

share|improve this answer

You must log in to answer this question.

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