Testing An SSH Key Passphrase

Keys on a keyring

Today I needed to get into a webserver, but every time I tried to SSH in it told me that the passphrase to my ssh key was wrong. WHAT?! How?!

OK, I'm dyslexic. This isn't that much of a surprise to be honest. I must be typing something wrong or remembering something wrong. But, if I go through and try all the different permutations of what I think my passphrase is, I'm going to set off alarms on the server I'm trying to log into and the person who owns it is going to be less than happy with me. (Especially since they are on the other side of the planet and are probably going to get woken up by annoying alerts on their phone telling them that their idiot friend can't remember how to log into a server.)

So, what I need is to test my passphrase offline against the ssh key. How do I do that?

ssh-keygen -y -f .ssh/id_rsa

This command will ask me for the passphrase for my ssh key. If I put in the right password, it will display my key. If I put in the wrong password, it will call me a failure at life tell me that I have input the incorrect passphrase. Very useful.