2

I am trying generate in bash sub keys for a keyring without any keyboard interaction. I have tried several approach around what is mentioned here

https://unix.stackexchange.com/questions/60213/gpg-asks-for-password-even-with-passphrase

The following command ask for password but does generates the sub key even if no password is entered with cancel button:

gpg2 --passphrase-file <(echo $pass_poem) --batch --quick-addkey $keyring_hash_id rsa1024 sign 1y

Same behavior with this one:

echo $pass_poem | gpg2 --batch --no-tty --yes --passphrase-fd 0 --quick-addkey $keyring_hash_id rsa1024 sign 1y

I use Ubuntu with and gpg 2.1.15 with libgcrypt 1.7.2-beta

Anyone understands why such a behavior?

Many thx

1 Answers1

1

Solution close from

GPG2 Asks for password even with --passphrase specified

Explanation can be found here:

https://wiki.archlinux.org/....

adding the following line to the ~/.gnupg/gpg-agent.conf file made it:

pinentry-mode loopback

But this is not recommended as it may break other usage.

Here is a solution:

echo $pass_poem | gpg2 --pinentry-mode loopback --batch --no-tty --yes --passphrase-fd 0 --quick-addkey $keyring_hash_id rsa1024 sign 1y