ssh-agent env variables not set when not using Bourne shell

Bug #1236299 reported by Andrew Stevenson
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

When I start an X session (default gnome/unity setup) I find that ssh-agent is started but the appropriate environment variables (SSH_AGENT_PID, SSH_AUTH_SOCK) are not set. .xsession-errors contains:

init: ssh-agent pre-start process (1797) terminated with status 127

The problem appears to be in /usr/share/upstart/sessions/ssh-agent.conf. It evals ssh-agent expecting the output to be valid Bourne shell syntax however ssh-agent checks (IIUC) the user's shell and output C shell style code if the user is using a C based shell. I use tcsh and so get output like 'setenv SSH_AGENT_PID ...' from ssh-agent. This of course fails to set any environment variables in the Bourne shell script that the upstart job effectively is.

Luckily ssh-agent has a flag to ask for Bourne shell syntax.

--- ssh-agent.conf.orig 2013-10-07 11:30:08.546222472 +0200
+++ ssh-agent.conf 2013-10-07 11:30:30.858221774 +0200
@@ -7,7 +7,7 @@
     [ -e /etc/X11/Xsession.options ] || { stop; exit 0; }
     grep -q "^use-ssh-agent$" /etc/X11/Xsession.options || { stop; exit 0; }

- eval "$(ssh-agent)" >/dev/null
+ eval "$(ssh-agent -s)" >/dev/null
     initctl set-env --global SSH_AUTH_SOCK=$SSH_AUTH_SOCK
     initctl set-env --global SSH_AGENT_PID=$SSH_AGENT_PID
 end script

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: openssh-client 1:6.2p2-6 [modified: usr/share/upstart/sessions/ssh-agent.conf]
ProcVersionSignature: Ubuntu 3.11.0-11.17-generic 3.11.3
Uname: Linux 3.11.0-11-generic x86_64
ApportVersion: 2.12.5-0ubuntu1
Architecture: amd64
Date: Mon Oct 7 12:50:45 2013
InstallationDate: Installed on 2013-06-28 (101 days ago)
InstallationMedia: Ubuntu 12.04.2 LTS "Precise Pangolin" - Release amd64 (20130213)
MarkForUpload: True
RelatedPackageVersions:
 ssh-askpass N/A
 libpam-ssh N/A
 keychain N/A
 ssh-askpass-gnome 1:6.2p2-6
SSHClientVersion: OpenSSH_6.2p2 Ubuntu-6, OpenSSL 1.0.1e 11 Feb 2013
SourcePackage: openssh
UpgradeStatus: Upgraded to saucy on 2013-09-23 (14 days ago)

Revision history for this message
Andrew Stevenson (andrew-n1by9anq9) wrote :
Changed in openssh (Ubuntu):
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openssh (Ubuntu):
status: New → Confirmed
Revision history for this message
Chris Perry (perrych2) wrote :

Thank you so much for posting this bug and solution Andrew! I just wasted several hours trying to hunt this down. The number of hacky solutions being used by people to get around this is really quite disturbing. I wonder why this 3 character fix didn't make it into 14.04... woulda saved me a bunch of time.

Revision history for this message
Andrew Stevenson (andrew-n1by9anq9) wrote :

This appears to be fixed, at least in 1:6.6p1-2ubuntu2

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.