OM4 Agency Logo All White

Mac Leopard: ssh, RSA key pairs, passphrases and the annoying password window

If you are getting stuck at this prompt, read this post
If you are getting stuck at this prompt, read this post
As I was monitoring our servers for a period over the holidays, I had a chance to get back to grips with ssh. Here is a quick public service announcement for any Mac users out there who are using ssh and RSA keypairs who are encountering a window asking you to:
Enter your password for the SSH key “id_rsa”

In short, if you use ssh to connect to a remote server, you can setup an RSA public/private key pair to allow you to connect to your server without a password. In Leopard 10.5 this doesn’t seem to always work as it used to, and I couldn’t find an article that gave a solution.

So, here is a way to get your passphrase loaded in to your keychain to avoid the annoying password window (that won’t let you enter your ‘password’).

1. Clear the contents of your ~/.ssh directory and set the directory permissions to 600
$ rm ~/.ssh/*
$ chmod 600 ~/.ssh

2. Generate your rsa key pair (there are variations for this, but this is the version I used):
$ ssh-keygen -t rsa

3. Set the permissions for all files in ~/.ssh to 600
$ chmod 600 ~/.ssh

4. Copy your key to your server’s .ssh/authorized_keys file

5. Add your passphrase to your keychain using this command:
$ ssh-add -K
(you will see Enter passphrase for [your system]/.ssh/id_rsa: )

6. You are all set to login using ssh without a password

This is a solution to the passphrase problem – here is more general information if you want to learn more about setting up ssh with an RSA key pair.

OM4 Agency Logo White

About OM4

OM4 is an Australian based web agency that helps you find customers and convert online. We specialise in creating custom designed WordPress and WooCommerce websites that our clients can update themselves. So you get to express your brand without being tied down to the constraints of a template, but you can still update your own content using a state of the art page builder. We develop plugins, so we know our way around code. Interested? We’d love you to get in touch.