`gpg --pinentry-mode loopback` used to ask passphrase once but now it asks always
2
votes
1
answer
1333
views
In short (Edit 1): How to make
gpg -qd --pinentry-mode loopback out.gpg
cache the passphrase for a period of time in the cli. It used to cache but now it doesn't.
Edit 2: I have tried this thing in both Kubuntu 24.04 Live iso image and a very old live iso image from 2017 called GParted live. In Gparted live iso, --pinentry-mode loopback
caches the passphrase but not in Kubuntu live iso.
Edit 3: I have tested in Kubuntu 22.04, 23.10 and 24.04 using https://distrosea.com and gpg --pinentry-mode loopback
symmetric decryption does indeed not cache the passphrase except 22.04.
And now the boring details:
In Kubuntu 22.04, I used to use these commands to create an encrypted file from stdin and to decrypt it:
gpg --pinentry-mode loopback --output out.gpg --symmetric -
to encrypt
gpg --pinentry-mode loopback -qd out.gpg
to decrypt.
While in a terminal session, the decryption command used to ask for the passphrase once for a certain time and I don't remember I did anything to get this behavior.
Now I have upgraded to Kubuntu 24.04 (by fully erasing the disk). But now, the decryption command above always asks for the passphrase in the same terminal session.
If I remove --pinentry-mode loopback
, then the pinentry-qt
dialog kicks and finally the decryption command stops asking for the passphrase for subsequent decryption commands with --pinentry-mode loopback
.
So pinentry-qt
correctly caches the passphrase but any subsequent--pinentry-mode loopback
command requires a passphrase input with pinentry-qt
in order not ask for the passphrase again.
I installed pinentry-tty
and set the config in ~/.gnupg/gpg-agent.conf
to:
pinentry-program /usr/bin/pinentry-tty
and reloading the agent by:
gpg-connect-agent reloadagent /bye
.
This actually solves my problem by decrypting without using --pinentry-mode loopback
. But what I want is the old (no config) behavior so I can get rid of updating all my scripts.
Asked by mrdolichenus
(21 rep)
May 22, 2024, 07:03 AM
Last activity: May 23, 2024, 03:49 PM
Last activity: May 23, 2024, 03:49 PM