4

When I run ssh-keygen and press return instead of inputting a password then I can add the key with ssh-add ~/.ssh/id_rsa.pub. I am prompted to enter the passphre for ~/.ssh/id_rsa.pub. I simply press enter and all is well.

However - when I do input a password at ssh-keygen stage, and then reenter the same password at ssh-add stage it fails with bad passphrase, try again

Am I missing something?

6
  • Have you tried this with cutting & pasting the password, thus making sure it is definitely not mistyped?
    – user260419
    Dec 2, 2013 at 8:17
  • I used passwords such as "password", and "pass", which is hard to mistype - but I will try pasting. Dec 2, 2013 at 9:24
  • I'm sure you did, this is just to exclude the possibility.
    – user260419
    Dec 2, 2013 at 9:25
  • 1
    That looks like an encoding problem, maybe ? what does env | grep LANGgives you ?
    – mveroone
    Dec 2, 2013 at 9:44
  • @Kwaio out: "LANG=en_GB.UTF-8" and "LANGUAGE=en_GB:en" What should we expect? Dec 2, 2013 at 23:25

1 Answer 1

7

You need to add the private key to the ssh-agent, not the public key. The default key name is id_rsa, so you don't even need any options:

ssh-add

If you've named your key something else (e.g.) github_dsa, then use:

ssh-add github_dsa

Note to internet interlopers: if you didn't use ssh-keygen to generate the key, make sure your key is in SSH format. For PuttyGen, for example, there's an export option that you need to use.

0

You must log in to answer this question.

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