gpg and smartcard on ubuntu 16.04

Peter Lebbing peter at
Thu Apr 28 12:45:52 CEST 2016

On 28/04/16 02:23, NIIBE Yutaka wrote:
> In my environment of Debian, those variables are set by:
> /etc/X11/Xsession.d/90gpg-agent

After I installed GnuPG 2.1 on my Debian Jessie (which doesn't have 2.1
itself), I encountered annoying issues. I also use smartcards, for SSH
auth as well. I got it to run much smoother by editing this file to be
the attached file. It did have a gotcha: if there isn't an agent
running, you have to do something like:

$ gpg-connect-agent /bye

before you can do SSH auth. Note that the agent survives a logout/login.

I got the impression that the explicit starting of the daemon in the
startup script somehow messed something up. But I had some trouble
pinning down the exact problem, and since it now works in a way that
works for me, I left it at this.

Perhaps you could just add the gpg-connect-agent call to the
if-ssh-support conditional, and it would be purrfect. I will try that
now and see if everything stays peachy.



I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <>
-------------- next part --------------
: ${GNUPGHOME=$HOME/.gnupg}

if grep -qs '^[[:space:]]*enable-ssh-support' "${GNUPGHOME}/gpg-agent.conf"; then
    export SSH_AUTH_SOCK

More information about the Gnupg-users mailing list