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 ssh
shows that ssh-agent
is 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-agent
is 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