Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Ssh keys work fine, if indicated in ./ssh/config but if i try
$ssh-add mykey
Could not open a connection to your authentication agent
even with ssh-add -l give the same result

share|improve this question
2  
Is ssh-agent running? Try echo $SSH_AUTH_SOCK; echo $SSH_AGENT_PID. –  Mikel Jan 6 '13 at 15:50

1 Answer 1

up vote 1 down vote accepted

ssh-add tries to add a key to the agent, but on your system no ssh-agent is running.

ssh has two different modes of working with keys. Either ssh is connecting to the agent and asking the agent to authenticate, or ssh is reading the key from disk.

As there is no agent running on your system the first mode is failing but the second one works, because there is no agent involved.

You can temporarily start an agent by ssh-agent bash. Afterwards ssh-add should work without problems.

Usually the agent is started with your desktop environment. If you are not using a desktop environment you have to make sure by yourself that an agent is running if you need it.

If you are connected to a remote host by ssh. Then you might want to transfer your local agent to the remote host. Use ssh -A if that is what you want.

share|improve this answer

Your Answer

 
discard

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.