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


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
            exec /usr/bin/pinentry-curses "$@"
            exec /usr/bin/pinentry-qt "$@"
  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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.