There are 2 users: user1 and user2. When trying to use gpg via sudo (symmetric decryption):
user1@host: sudo -u user2 gpg /home/user2/pass.gpg
an error
gpg: decryption failed: No secret key.
I set it to --pinentry-mode loopback and the password request happens (right in the terminal), I type and the decryption happens. Tell me, is this approach safe?
I can't understand how this option works. The GnuPG website says:
Redirect Pinentry queries to the caller. This enables the use of gpgme_set_passphrase_cb because pinentry queries are redirected to gpgme.