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 set up a new user account for a friend on Kubuntu 12.04. When he uses ssh he gets this error:

Could not open a connection to your authentication agent

We're running ssh in some bash scripts.

After looking around at the wide variety of things that can lead to that error, I came across this solution:

$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/some_id_rsa

Then he can run the ssh commands (and bash scripts) as expected.

Before running those two commands, the env variables are not set in a terminal:

$ echo $SSH_AGENT_PID

$ echo $SSH_AUTH_SOCK

$ 

After running the commands, the env variables are set as expected. However, they do not stay set (e.g., in a different shell or after rebooting).

I want to know how to set up his computer so he doesn't have to run those two commands to set the env variables. I do not need to run them on my computer (ever). So far I am not seeing what is different between our machines.

I see this info in the man page, but it does not tell me how Ubuntu is normally setting up the agent automatically or what is happening on my friend's machine so that this is not working for him.

 There are two main ways to get an agent set up: The first is that the
 agent starts a new subcommand into which some environment variables are
 exported, eg ssh-agent xterm &.  The second is that the agent prints the
 needed shell commands (either sh(1) or csh(1) syntax can be generated)
 which can be evalled in the calling shell, eg eval �‘ssh-agent -s�‘ for
 Bourne-type shells such as sh(1) or ksh(1) and eval �‘ssh-agent -c�‘ for
 csh(1) and derivatives.

After installing acct and rebooting, this is the output of lastcomm:

ssh-agent         F    newuser __         0.12 secs Wed Aug  7 11:02
ssh-agent         F    newuser __         0.00 secs Wed Aug  7 20:34
ssh-agent         F    newuser __         0.02 secs Wed Aug  7 20:02
ssh-agent         F    newuser __         0.01 secs Thu Aug  8 12:39
ssh-agent         F    newuser __         0.02 secs Thu Aug  8 07:45

From the man page:

F -- command executed after a fork but without a following exec

I'm not sure if that is significant.

share|improve this question
    
Under Ubuntu, ssh-agent is normally started from /etc/X11/Xsession.d/90x11-common_ssh-agent. This can be suppressed by removing use-ssh-agent from /etc/X11/Xsession. Are those files correct? Is the agent started and then killed or never started? (Install acct and run lastcomm after logging in to see what programs were lauched.) –  Gilles Aug 9 '13 at 0:31
    
@Gilles-thank you. Those two files are identical on my machine and his machine. We both have X11/Xsession.options:use-ssh-agent and X11/Xsession.d/90x11-common_ssh-agent:SSHAGENT=/usr/bin/ssh-agent. I will try acct and lastcomm next. Thanks –  MountainX Aug 9 '13 at 3:43
    
updated question –  MountainX Aug 9 '13 at 4:19
    
still looking for a solution... –  MountainX Aug 10 '13 at 18:33
    
Please post the output of lastcomm for a full session, not just the ssh-agent process. The point is to see in what order various programs are started. –  Gilles Aug 10 '13 at 22:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.