in Code, Geeklife, Linux

ssh-add -l -> Cannot connect to your agent.

keychain not working for ya…
you run ssh-agent but ssh-add won’t add the keys.

This is probably because your SSH_AGENT_PID and SSH_AUTH_SOCK variables are incorrect…

so I recommend you put something like this on your .bashrc to initialize your ssh-agent correctly:


#make sure no old agents are running
killall ssh-agent

#grab the text output of ssh-agent and evaluate it 
#so the correct variables are exported
eval `ssh-agent`

#add your private key(s) to the agent
ssh-add ~/.ssh/id_dsa
#ssh-add ~/.ssh/my_other_dsa_key

#at this point the script will ask you for the passwords of your keys
#if you protected them with passwords (recommended)

#list the available keys to make sure they were added
ssh-add -l

After this, you should be able to login without a password, on whatever other hosts you put the public keys (at .ssh/authorized_keys or .ssh/authorized_keys2)

Write a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.