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.

I've been trying to get ssh-add working on a RaspberryPi running Raspbian.

I can start ssh-agent, when I do it gives the following output into the terminal:

SSH_AUTH_SOCK=/tmp/ssh-06TcpPflMg58/agent.2806; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2807; export SSH_AGENT_PID;
echo Agent pid 2807;

If I run ps aux | grep ssh I can see it is running.

Then I try to run ssh-add in order to add my key passphrase, and I get the following:

Could not open a connection to your authentication agent.

Any ideas?

share|improve this question
3  
Try eval $(ssh-agent) –  Ulrich Dangel Sep 22 '12 at 15:28

3 Answers 3

If using csh as a shell (FreeBSD PI) this could work:

eval `ssh-agent -c`

next you only need to do something like:

ssh-add ~/.ssh/id_rsa
share|improve this answer

Try this one:

$ ssh-agent /bin/sh
$ ssh-add $yourkey
share|improve this answer

Your shell is meant to evaluate that shell code output by ssh-agent. Run this instead:

eval "$(ssh-agent)"

Or if you've started ssh-agent already, copy paste it to your shell prompt (assuming you're running a Bourne-like shell).

ssh commands need to know how to talk to the ssh-agent, they know that from the SSH_AUTH_SOCK environment variable.

share|improve this answer
    
Thanks, I didn't quite understand how it works. Thats very muchly appreciated. –  Daniel Groves Sep 22 '12 at 17:30
1  
Or you can enter ssh-agent bash and after the ssh-add will work –  RaduM May 15 '13 at 13:56
    
@Stephane, do I get it correctly that ssh-agent command just prints the output of it's execution while eval version actually runs the command? –  Denys S. Oct 7 '13 at 8:50
1  
@DenysS. Well no, it does its setup and then tells your shell how to update its environment to be able to contact it. It cannot do that by itself. It can start a new shell with the updated environment (that's what ssh-agent bash does), but it cannot update the memory of a separate process running a foreign command (your already running shell). –  Stéphane Chazelas Oct 7 '13 at 9:03
    
@StephaneChazelas, if my ssh-agent is started on boot but I still have to eval it in my shell does it mean that it is not automatically evaluated for every shell and has to be configured somehow by the root user? –  Denys S. Oct 7 '13 at 9:10

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.