Sample Header Ad - 728x90

gpg/pinentry - Can't enter passphrase outside terminal

2 votes
1 answer
1680 views
I am trying to decrypt a gpg file inside a script. When I run gpg -d file.gpg in the terminal, I get prompted to enter the password in a curses dialog box. But when I run a script containing that line, I get "gpg: decryption failed: No secret key", or a silent failure if not run from an interactive terminal. Ideally, if gpg is trying to run from a non-interactive shell (I think that's the word for what I mean but I'm not sure - basically if it's run from a script), when I'm running X, then I would like it to open a terminal window running pinentry-curses. If I set my pinentry program to run with qt or gtk, then a graphical window pops up every time, no matter where it comes from. That's the kind of behaviour I'd like to replicate - I just don't want it to depend on qt or gtk.
Asked by preferred_anon (350 rep)
Nov 6, 2020, 12:00 PM
Last activity: Nov 7, 2020, 06:56 PM