Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to add an ssh key using ssh-add. Upon running ssh-add ~/.ssh/insertkeynamehere I am prompted with:

Could not open a connection to your authentication agent.

After doing some research it would appear as if this is because my ssh-agent is not running but ps -ef | grep ssh-agent indicates otherwise:

cdm       1760  1727  0 14:35 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=classic-gnome

Even after running:

exec ssh-add bash

And seeing:

cdm       1760  1727  0 14:35 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=classic-gnome
cdm       2903     1  0 14:45 ?        00:00:00 ssh-agent

This problem still seems to persist. Any help would be much appreciated and if you need to see anymore console output let me know and I'll be happy to post.

*Note I am using Ubuntu 11.04

share|improve this question
up vote 2 down vote accepted


$ `eval ssh-agent`

Which echo series of environment variables making ssh-add to work. Just paste that into your terminal and:

$ exec ssh-agent bash


$ ssh-add ~/.ssh/insertkeynamehere

source: Ubuntu manpages: ssh-add

share|improve this answer
Thanks for the suggestion, after running 'eval ssh-agent' I received: SSH_AUTH_SOCK=/tmp/ssh-fSYxVokg3559/agent.3559; export SSH_AUTH_SOCK; SSH_AGENT_PID=3560; export SSH_AGENT_PID; echo Agent pid 3560; After running the add again the same 'Could not open a connection to your authentication agent.' – user380166 Oct 27 '11 at 16:52
Then, try again the "exec ssh-agent bash" ? I have edited my Answer. – Adrien P. Oct 27 '11 at 16:55
Still no luck even with the exec ssh-agent bash. – user380166 Oct 27 '11 at 17:10
Strange, did you paste the output of 'eval ssh-agent' into your terminal before using ssh-add ? – Adrien P. Oct 27 '11 at 17:13
Oops, didn't paste in the output, it appears to be working now, thanks for your help. – user380166 Oct 27 '11 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.