A one-liner GPG passphrase prompt?

Tobias Girstmair t-passwd at girst.at
Fri Apr 5 16:29:56 UTC 2024


hi all, recently i wrote the following on this list:

On Sat, Mar 02, 2024 at 06:29:34PM +0100, Tobias Girstmair wrote:
>some time ago, i attempted to write a small shell script 
>querying $DISPLAY to switch between the tty and gtk pinentry programs 
>on the fly, but that did not work (the environment variable was always 
>unset). maybe someone else has a solution to that (i'm fairly sure it 
>should be possible - pinentry-gtk-2 falls back to its own curses based 
>TUI when needed).

I figured this out, btw.

     ~ %  cat .gnupg/gpg-agent.conf
     enable-ssh-support
     pinentry-program /usr/local/bin/pinentry-ttygtk

     ~ %  cat /usr/local/bin/pinentry-ttygtk
     #!/bin/sh
     case "$*" in
     *--display*) exec /usr/bin/pinentry-gnome3 "$@" ;;
     *) exec /usr/bin/pinentry-tty "$@" ;;
     esac

this gives me a nice gtk3 based gui when available, and a tiny 
(non-curses!) cli interface when not (e.g. remotely over ssh).

hope that's useful to someone,
	tobi


More information about the Password-Store mailing list