4

I'm having a problem using ssh agent to make sure I don't have to enter a password each time a certain program uses my id_rsa private key.

I did ssh-add -K ~/.ssh/id_rsa and it seemed to add an entry to my keychain

But it continues to prompt me. When I go into keychain under access control, it looks like maybe it's because it's not set

3 Answers 3

3

Double check your permissions in those files, if they are not like this, it won’t work:

-rw-------  1 martin  staff   1675 Jul 27  2009 id_rsa
-rw-r--r--  1 martin  staff    403 Jul 27  2009 id_rsa.pub

UPDATE: If you see that the files have an @, that means they have “extended attributes”.

You can see what they are by issuing:

xattr -l <filename>
3
  • Mine looks exactly like that except that I have @ signs after each
    – Jody G
    Nov 27, 2010 at 15:07
  • How might extended attributes help or hinder setting up ssh? Or are you saying that all extended attributes must be removed?
    – bmike
    Dec 26, 2013 at 14:04
  • Whoa, old question. As far as I can remember, the ssh key files must not have any sort of extended attribute or the ssh client refuses to take them, but this should be tested on a modern system. Dec 26, 2013 at 19:18
2

Connect manually from Terminal using the verbose options to see where your problem lies, if it's a client-side problem. You might also want to check the error logs on the server to find out if your publickey is getting rejected. Permissions on the user folder, the .ssh folder, and the files within (like authorized_keys) need to have all group/other write permissions removed, on both the client and the server. SSH is very picky about permissions and will not use anything that is accessible to anyone other than you.

2
  • Once I'm prompted for my key's password though, it works so that must mean that it's accepting my key. It seems though that it's the ssh agent not working for some reason, otherwise it wouldn't prompt me every time for my password.
    – Jody G
    Dec 1, 2010 at 23:16
  • Open Keychain access and find the item for your id_rsa key, and Get Info it. Tick the box next to Show password (you'll be prompted for your keychain's password) and see if your key's password is being stored. If it isn't, I think you can just enter it right there in Keychain Access
    – Tim
    Dec 2, 2010 at 2:50
2

I had this problem as well. For me /usr/bin/ssh-agent shuts off after a while.

pgrep ssh-agent


/usr/bin/ssh-agent -s  #should show you something like this

SSH_AUTH_SOCK=/tmp/ssh-OYn3ShRY4l/agent.37715; export SSH_AUTH_SOCK;
SSH_AGENT_PID=37716; export SSH_AGENT_PID;
echo Agent pid 37716;

I even got irritated, and removed the OS X programs from the Access Control side and replaced them with up to date, modern MacPorts versions. All is fine, except that Keychain Accesss is a bit flaky. My version of ssh-add runs forever. You only need to run the 'ancient of days' version /usr/bin/ssh once to get your key into your keychain.

You must log in to answer this question.

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