It turned out to be easier than I expected. First, some background:
When you log into gdm, it starts up your X session by running /etc/gdm/Xsession
, which is a symlink to /etc/X11/xinit/Xsession
. This is a shell script that receives a single parameter from the display manager -- for Gnome, this is gnome-session
. There's an ugly case statement in this script that figures out the next step based on the display manager in use; for Gnome, it ends up doing this:
gnome|gnome-session)
# lack of SSH_AGENT is intentional, see #441123. though
# the whole thing should really happen in xinitrc.d anyway.
exec -l $SHELL -c gnome-session
exec /bin/sh -c "exec -l $SHELL -c \"gnome-session\""
;;
I thought at first I was going to have to modify this script, which would have been an ugly hack -- future package updates would probably revert my changes. Fortunately, earlier on in the script is this snippet of code:
XCLIENTS_D=/etc/X11/xinit/Xclients.d
if [ "$#" -eq 1 ] && [ -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
exec -l $SHELL -c "$CK_XINIT_SESSION $SSH_AGENT $XCLIENTS_D/Xclients.$1.sh"
else
This looks in /etc/X11/xinit/Xclientds.d
for a display-manager specific Xclients
script, and runs that instead of the case statement if one is available. So I created `/etc/X11/xinit/Xclients.d/Xclients.gnome-session.sh with the following contents:
#!/bin/sh
exec -l $SHELL -c "$SSH_AGENT gnome-session"
This takes advantage of the SSH_AGENT
variable set earlier by xinitrc-common
. This gets me a session running under ssh-agent
, which is just what I wanted.
There was another problem, however: files in /etc/xdg/autostart
were still starting up the gnome-keyring-daemon
agent. It's possible to modify or remove these files, but since they're not marked as configuration files in the gnome-keyring
package they'll come back to haunt me in the event this packages gets updated.
So for the time being, I've wielded the Hammer of Chmod:
chmod 0 /usr/bin/gnome-keyring-daemon
It's not pretty, but it gets me what I want: the ability to load SSH certificates in my desktop environment.
The (shortened) URL has gone offline, here's a link to the archive.