SSH: "Bad passphrase" after generation of public key

TomDogg picture TomDogg · Dec 16, 2013 · Viewed 35.5k times · Source

When I execute these commands (setting a passphrase, after the first)...

$ ssh-keygen -t dsa
$ chmod 600 my_key
$ chmod 600 my_key.pub

...and then, to test the passphrase...

$ ssh-add my_key.pub

...I keep getting:

Bad passphrase, try again for my_key.pub:
Bad passphrase, try again for my_key.pub:
Bad passphrase, try again for my_key.pub:
Bad passphrase, try again for my_key.pub:
...

What am I doing wrong?

This is on Ubuntu.

Answer

favoretti picture favoretti · Dec 16, 2013

You're trying to add public key to the agent, that one isn't pass-protected, the private one is. Try adding your private key and it should work.