GPG fails with gpg: problem with the agent: Permission denied
when I invoke it after switching my user with su
:
su - user2
gpg --symmetric --passphrase=foo foo.txt
If I invoke the command from my own user, it doesn't fail. Is there a workaround?
I found a thread a thread in their mailing list about it but it's unanswered. It speculates that the error is because:
the tty is owned by the original user I logged into via SSH, not the user I switched to via su