GnuPG places its socket S.gpg-agent at ~/.gnupg/S.gpg-agent by default. I didn't find any way to configure the location of this socket nor seems there to be a manpage of gpg.conf.

Background: I want to symlink ~/.gnupg to an OpenAFS mount which doesn't support sockets (and avoid to create a symlink for every file in ~/.gnupg (which is a workaround) instead of just ~/.gnupg), i.e. find the most elegant solution imo.

2 Answers 2


Since GnuPG Version 2.1.1 there exists a solution: Place a simple text-file S.gpg-agent in the gpg-homedir with following content:


It replaces some evnvars like ${HOME} or ${HOSTNAME}

Be careful, when using a subdirectory of /tmp, because gpg-agent will not create needed directories.

Further reading at: https://dev.gnupg.org/T1752

  • This no longer works, cf. bugs.debian.org/935966
    – mirabilos
    Aug 28, 2019 at 14:02
  • Unfortunately, for Windows, it never did. In assuan-socket.c in libassuan, it has "#ifndef HAVE_W32 SYSTEM" around that functionality. I could really use that functionality right now.
    – Jamie
    Mar 19, 2021 at 18:21

User ruhri's solution did not work for us on our Debian stretch systems. At least, we had to add more socket "redirects". Here is what worked for us.

  1. Create the .gnupg/S.gpg-agent file as described by ruhri:

  2. Add these two lines to the end of .gnupg/gpg-agent.conf (create file if it does not already exist):

    extra-socket /srv/scratch/joeuser/S.gpg-agent.extra
    browser-socket /srv/scratch/joeuser/S.gpg-agent.browser
  3. Create the file .gnupg/S.gpg-agent.ssh similar to the file .gnupg/S.gpg-agent:


This solution comes from this comment.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .