Home linux Error while running SSH Agent: Could not open a connection to your...

Error while running SSH Agent: Could not open a connection to your authentication agent

Author

Date

Category

On execution

ssh-agent -s

Writes the PID of ssh-agent’a, but when I try to do ssh-add I get an error:

Could not open a connection to your authentication agent

In this case, ps ax | grep sshshows that ssh-agentis running, it works correctly only when I run it like this: eval "$(ssh-agent -s)"what’s the difference?

I want to make auto key addition on reboot with the following script:

#!/bin/bash
cd /home/right/.ssh/
eval $(/usr/bin/ssh-agent -s)
/usr/bin/ssh-add github_cents

But in the end, the keys are not added, and ssh-agentis running


Answer 1

I did not find a solution specifically for this case. An alternative suitable in my case is to put the configuration for the desired host in ~ / .ssh / config:

Host server.com
  IdentityFile ~/keys/.ssh/id_dsa

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions