Override pinentry program in a terminal

password-store at storiepvtride.it password-store at storiepvtride.it
Mon May 18 10:43:37 CEST 2020


Am 17.05.20 um 23:16 schrieb Ismael Bouya:
> It’s quite outside of the scope of pass, so this discussion should
> probably happen somewhere else, but there is a way to do what you want:
> I wrote a wrapper that looks like that, which you need to put for instance in
> /usr/local/bin/pinentry-choose and use as the pinentry program

Ah very interesting, I didn't know about PINENTRY_USER_DATA, thanks!

For my case, I slightly changed your script based on this [0] suggestion:

#!/bin/bash
program="/usr/bin/pinentry-x11"
choice="${PINENTRY_USER_DATA-}"
case "${choice}" in
    tty|curses)
        program="/usr/bin/pinentry-$choice"
        ;;
    *)
        ;;
esac
$program "$@"

Also worth noting that ~/.gnupg/gpg-agent.conf should be created/updated
accordingly with:

pinentry-program /path/to/pinentry-choose

*and* for changes to take effect, "gpg-agent" should be killed with:

$ gpgconf --kill gpg-agent

Now I have the passphrase/pin prompt from both the bash CLI and from the
UI as well.

I find this question completely on scope because gpg-agent is right
behind password-store, its understanding not always easy to grasp and
the usage examples scarce.

Regards,

[0]
https://kevinlocke.name/bits/2019/07/31/prefer-terminal-for-gpg-pinentry/



More information about the Password-Store mailing list