gpg commands fail without offering password prompts
Issue
-
After using the
su
command to switch users, gpg doesn't allow entering a passphrase -- whether encrypting, decrypting, or generating a new key withgpg --gen-key
. Example:$ gpg -d testfile.gpg gpg: 3DES encrypted data can't connect to `/root/.gnupg/S.gpg-agent': No such file or directory gpg-agent[8750]: command get_passphrase failed: Operation cancelled gpg: cancelled by user gpg: encrypted with 1 passphrase gpg: decryption failed: No secret key
Environment
- Red Hat Enterprise Linux 6, 7, or 8
- gpg2 rpm
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.