Updating SSH Key List

While playing around with x2go tonight I realized I’d missed a critical step so I thought I’d share it here in case you run into the same problem. When I added my default (id_rsa) public key to the session configuration and enabled auto-login I was prompted several times to enter the passphrase. Unfortunately, the default key doesn’t have one. Rather than creating a new one that I’d have to update wherever it’d be used I opted to create a new key that included a passphrase. No problem, right? Right.

It’s easy enough to use ssh-keygen to create a new key pair. Where I went wrong is not adding the new key to ssh-agent. You’ll also run into this problem if you copy your new key to a remote computer. Rather than logging in directly as you’d expect you’ll find yourself still being prompted for a password.

In order to see what keys you have in the agent use the ssh-add command.

# ssh-add -l
2048 0d:a5:fd:87:42:9f:b2:02:06:54:90:88:e2:a6:c9:e0 /Users/me/.ssh/id_rsa (RSA)
1024 96:70:17:2a:22:0f:bf:d3:3d:41:e1:86:53:40:97:98 /Users/me/.ssh/webme_dsa (DSA)

Here you can see that I have two keys. One is a 2048-bit RSA key and the other is a 1024-bit DSA key used for my web provider. What I don’t see, though, is my new key, id_pwdrsa. Let’s see if we can fix that.

# ssh-add /Users/me/.ssh/id_pwdrsa
Enter passphrase for /Users/me/.ssh/id_pwdrsa: 
Identity added: /Users/me/.ssh/id_pwdrsa (/Users/me/.ssh/id_pwdrsa)

Now let’s verify that it’s listed.

# ssh-add -l
2048 0d:a5:fd:87:42:9f:b2:02:06:54:90:88:e2:a6:c9:e0 
     /Users/me/.ssh/id_rsa (RSA)
1024 96:70:17:2a:22:0f:bf:d3:3d:41:e1:86:53:40:97:98 
     /Users/me/.ssh/webme_dsa (DSA)
2048 31:01:90:dc:6f:50:83:5f:97:5a:18:f4:f6:c8:bf:8a 
     /Users/me/.ssh/id_pwdrsa (RSA)

Look at that. No password prompt.

I know I started talking about x2go but right now I think it sucks. The damned thing crashes on me even doing simple stuff like changing my session options. Grr.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.