6

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

7

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:

%Assuan%
socket=/path/to/where/ever/you/want/S.gpg-agent

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

2
  • 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
3

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:

    %Assuan%
    socket=/srv/scratch/joeuser/S.gpg-agent
    
  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:

    %Assuan%
    socket=/srv/scratch/joeuser/S.gpg-agent.ssh
    

This solution comes from this comment.

2
  • I'd be interested in knowing why this answer was down-voted.
    – Jamie
    Mar 17, 2021 at 19:31
  • Would also like to understand the downvote? It works as expected and I ran into the exact same issues. Without the additional files mentioned in the comment I would get ` error binding socket to` errors for the S.gpg-agent.extra and S.gpg-agent.ssh Mar 31, 2022 at 7:15

You must log in to answer this question.

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