using with su/sudo

John Lane gnupg at jelmail.com
Thu Oct 6 17:21:06 CEST 2016


The requirement for tty ownership for commands where pinentry is
required causes problems for shells opened with sudo or su, where
such commands generally result in a "permission denied" kind of error:

    $ gpg -d /tmp/encrypted.asc
    gpg: public key decryption failed: Permission denied

I can use "script" to work around this but it is a bit of a hack that
relies on the fact that "script" creates a new tty owned by the current
user:

    $ script -q -c 'gpg -d /tmp/encrypted.asc'

Is there a correct way to make gpg play nicely inside su/sudo ?

PS I am using su/sudo to change to another unprivileged user, not root.

Thanks,
John




More information about the Gnupg-users mailing list