Just one gpg-agent

Doug Barton dougb at dougbarton.us
Sat Mar 7 00:06:35 CET 2009


I have a slightly more sophisticated gpg-agent script that has worked
well for me with a variety of window managers:

--------------------------------------------------------------------
#!/bin/sh

PATH=/bin:/usr/bin:/usr/local/bin

test -e ${HOME}/.gpg-agent-info && unlink ${HOME}/.gpg-agent-info

killall -0 gpg-agent 2>/dev/null
running=$?
if [ "$running" -eq 0 ]; then
        killall gpg-agent
        sleep 1
        killall -0 gpg-agent 2>/dev/null && killall -9 gpg-agent
fi

[ "$1" = "stop" ] && exit 0

eval `gpg-agent --enable-ssh-support --daemon --write-env-file`

exit 0
--------------------------------------------------------------------

I then have the following in my .xsession file so that all of my
windows inherit the necessary stuff:

unset GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
${HOME}/.bin/gpg-agent.sh
if [ -r "${HOME}/.gpg-agent-info" ]; then
        . ${HOME}/.gpg-agent-info
        export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
fi


hope this helps,

Doug



More information about the Gnupg-users mailing list