Could not open a connection to your authentication agent.
28 August 2007, mid-morning
SSH private-keys are usually stored encrypted on the computers they are stored on. A pass-phrase is used to decrypt them when they are to be used. Since most people use SSH public-private key-pairs to get around typing in passwords all the time, the ssh-agent daemon exists to store decrypted private-keys you plan on using in a given session. The thing most people get tripped up on when using ssh-agent
is that what the program outputs, some borne or csh shell commands, needs to be run. It may look like ssh-agent has set some variables for you, but it has in fact done no such thing. If you call ssh-add
without processing ssh-agent
’s output, it will complain it is unable to open a connection to your authentication agent. The most straightforward way to run ssh-agent on the command line is as follows: eval `ssh-agent`
. After doing this, calls to ssh-add
should succeed without error.
Thank you for this tip, it saved my coffee-break time !
by Michaël on September 8 2007, 11:52 am #
You saved more than my coffee break! Thanks for the assistance!
by Stephen Mouring on March 15 2008, 2:46 pm #
Hi,
I have the ssh-agent running but I still get the error message that it is unable to open a connection to the authentication agent when I call “ssh-add”. Any idea if I’m missing some other step?
Appreciate your help!
by AR on April 14 2008, 1:52 pm #
Did you run it as specified above, by eval’ing the output? That’s really all you need to do. Otherwise just export the variables it spits out yourself.
by Ramanan on April 14 2008, 1:57 pm #
Thank you!
by Justin on May 14 2008, 2:01 pm #
Dear all,
I am a newbie on Linux and I am facing a similar problem.
I run eval ssh-agent on command line but I still can’t manage to open the connection. Is there something I am missing?
Thanks is advance.
by Sammie on May 29 2008, 10:11 am #
That’s really all you should need to do. You can manually export the variables ssh-agent spits out (copy and paste them all to the comand line), but basically, that’s what eval is doing.
by ramanan on May 30 2008, 11:04 am #
thanks a lot
by roby on July 7 2008, 7:39 am #
You can also do the following :
(dont forget to kill the old agent(s))
The punctuation is important.
This will read your agent setting into the shell :
. .agentinfo
And now starting the agent will continue without a problem.
ssh-agent
Make sure there is a space between the 2 dots. :/
by Leendert J.N. Schouten on July 29 2008, 5:36 am #
while executing ssh-add in windows xp command prompt it give “Could not open a connection to your authentication agent” could u pls help me to solve the problem
by ponmarimuthu.natesan on February 5 2009, 2:59 am #
Download putty and putty agent.
by ramanan on February 5 2009, 10:52 am #
Thanks A lot mate
by Faris Madi on March 15 2009, 3:49 am #
Had a problem: Could not open a connection to your authentication agent.
Second hit on the google.
Boooya here is the quick fix:
eval `ssh-agent`
You’re ace!
by Indrek on April 24 2009, 4:46 am #
Thanks .. was wondering why it was not working… saved my time
by Manoj on May 6 2009, 11:14 pm #
Thanks for the post, was facing this issue myself.
This happens specially when I try to log in as one account on my laptop, and then su – some_other_user, from where I try to do ssh-add.
I was thinking if I have to run more ssh-agent etc, but the fix was much simpler.
Guess its safe to put the eval in .bashrc.
by John Laker on May 26 2009, 9:39 pm #
Thanks :)
Saved my time!
by diogo on June 9 2009, 10:26 am #
Hi, i also have the same problem. i’ve done eval ‘same-agent’, still the same. “Could not open a connection to your authentication agent”. Any ideas what else i could do? Thanks
by Catherine on August 5 2009, 8:21 am #
I think you are using the wrong quote, it is not
'
, it’s`
, which is the quote string above the tab key on most keyboards.by ramanan on August 5 2009, 8:34 am #
ssh-agent is running o.k.
eval `ssh-agent` also giving output but still not able to add key
any suggestion?
by shail on May 25 2010, 8:12 pm #
Great!
by eugene on July 24 2010, 6:56 pm #
I am on Windows 7. Through MING32,I did
eval `ssh-agent`
followed by
ssh-add
It worked perfectly. But when I do something like
git ssh://git-master:port/path
I am getting an error:
Permission denied(publickey)
fatal: The remote end hung up unexpectedly
Any idea guys??
by kurt on November 25 2010, 12:12 pm #
Is your public key on the authorized keys list on the remote server? It doesn’t sound like this is an issue with ssh-agent.
by ramanan on November 25 2010, 12:16 pm #
Yes. The problem was with the user name in the config file. I had misspelled it. Now it works fine. My bad. Thanx.
by kurt on November 26 2010, 9:14 am #
By the way does anybody have an idea , how to fetch the remote repository via Gitsharp? Gitsharp documentation is very bad.
by kurt on November 26 2010, 9:21 am #
Thankyou so much my friend !!
by Ashok Raj on March 7 2011, 6:47 pm #
thanks man you save my day! :)
by somuchbetter on June 17 2011, 4:57 am #
I was able to get my ssh-add working after finding your thread and changing to:
eval `ssh-agent`
other posts suggested using exec which didn’t work for me.
Thank you!
by Low351 on October 27 2011, 10:29 am #
hello sir,
i am trying go do single sign on using ssh.
but it is not working . configuration is as follows:
user1:
1)ssh-keygen
2) scp id_rsa.pub user2@server1:/home/user2/.ssh/authorized_keys
user2:
1)eval ssh-agent
2)ssh user1@server1
but it is asking password every time.
pls help me
by saireddysateesh on October 27 2011, 10:54 am #
You need the back ticks around the ssh-agent call:
eval `ssh-agent`
.by ramanan on October 27 2011, 12:57 pm #
Cheers for that, got my automated backups working again… very helpful indeed.
by Mark on November 8 2011, 10:15 am #
thnx that was very helpful
especially the commant specifying that it was eval `ssh-agent`not ‘ssh-agent’.
However i don’t seem to get the ssh-add to store my key permanently and i have to re ssh-add the key on every logon ,
can it be fixed plz
by wadii on November 16 2011, 9:39 pm #
Nice! Was tripping up on the exact thing you specified…easy peasy, thanks!
by Brock Harris on January 11 2012, 4:14 pm #
thank you very much it works perfectly!!!!
by me on January 14 2012, 7:57 pm #
Thanks ramanan, really useful tip, I would have been struggling with that for ages!
by sam on March 6 2012, 2:31 pm #
This is probably by far my greatest contribution to the Internet.
by Ramanan on March 8 2012, 9:08 am #
thank you so much..
this blog save my day..
by mfebrianto on April 16 2012, 8:04 pm #
ramanan opened my eyes. i was using the wrong quote’s . one should use ` and not ‘. wrote this again, if someone missed ramanan’s comment. Thanks so much.
by Vishal on July 20 2012, 5:42 am #
It worked for me.
by ilayaraja on July 30 2012, 3:27 am #
Great Man
by admin on August 18 2012, 5:44 am #
this tip is so great you need even more comments! Thx!
by bwanamarko on September 7 2012, 4:44 am #
You hit the nail right on the head — thanks for the tip!
by Mash on April 17 2013, 7:36 pm #
Thank you, your tip (using ` located above TAB key) worked for me.
by raj on July 10 2013, 5:39 pm #
Thank you!, worked like a charm. saved me a lot of trouble.
by Xiao on October 30 2013, 5:20 pm #
Just wanted to add to the list of thanks :)
I appreciate the effort you put into this, thanks!
by besamelsosu on January 13 2014, 5:23 am #
Thanks, this helped me.
by ajitsen on March 17 2014, 8:18 am #