2

I use pinentry-qt most of the time, but in the specific case that I'm using pass, I would like to use pinentry-curses because of the faster startup time.

Is there a way that I can configure pass to always call pinentry-curses, while keeping pinentry-qt the system default?

The system is Fedora with KDE.

This seems closely related but I don't know enough to apply it to pass: Change pinentry program temporarily with gpg-agent

1 Answer 1

2

Taking inspiration from the question you linked:

  1. Create a wrapper script for pinentry (~/bin/pinentry-wrapper):

    #!/usr/bin/env bash
    #
    # Defaults to Qt, with a choice of curses for selected programs
    # PINENTRY_USER_DATA is a GnuPG defined variable (see man gpg)
    
    case "$PINENTRY_USER_DATA" in
        curses)
            exec /usr/bin/pinentry-curses "$@"
            ;;
        *)
            exec /usr/bin/pinentry-qt "$@"
            ;;
    esac
    
  2. Make the script executable:

    $ chmod u+x ~/bin/pinentry-wrapper
    
  3. Instruct GnuGP to use your version of pinentry (~/.gnupg/gpg-agent.conf):

    pinentry-program /home/neftas/bin/pinentry-wrapper
    
  4. Restart the gpg-agent:

    $ pkill -HUP gpg-agent
    
  5. Create a wrapper script for pass (~/bin/pass):

    #!/usr/bin/env bash
    
    PINENTRY_USER_DATA=curses /usr/bin/pass "$@"
    
  6. Make executable:

    $ chmod u+x ~/bin/pass
    
  7. Make sure ~/bin is searched first in your PATH (put this in your .bashrc):

    $ export PATH="~/bin:$PATH"
    
  8. Check your work:

    $ command -v pass
    /home/neftas/bin/pass
    

All of these scripts were written on Arch Linux, so the locations may be different on your distro.

1
  • The second wrapper seems unnecessary. At least I only wanted curses when working from a shell, so followed steps 1-4. here then simply added PINENTRY_USER_DATA=curses to my ~/.bashrc|.zshrc.
    – pip
    Commented Feb 28, 2023 at 7:05

You must log in to answer this question.

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