I have a use case where gpg needs to work non-interactively with a smartcard (here, a YubiKey). According to the docs [1], it is possible to seed gpg-agent with passphrases, using the gpg-preset-passphrase utility. This requires starting gpg-agent with --allow-preset-passphrase, which I have done. However, no matter what I do, I still always get a PIN request. Steps to reproduce: 1. Add allow-preset-passphrase to $GNUPGHOME/gpg-agent.conf 2. Reload the agent 3. Get the relevant keygrip (here, for a [S]igning subkey): $ KEYGRIP="$(gpg --list-secret-keys --with-keygrip | \ grep -A 1 '\[S\]' | \ sed -nr 's/.*Keygrip = ([A-F0-9]+)/\1/p')" 4. Seed the agent: $ echo "MY_PASSWORD" | \ /usr/lib/gnupg/gpg-preset-passphrase --preset "$GPG_KEYGRIP" 5. Try signing something: $ gpg --sign --output /dev/null /dev/null And the PIN dialog still always appears. I think I've tried all variations of this: preseeding all available keygrips with the password (in case I got the wrong one), using FPRs, using echo -n, etc. From the various examples I can find on the net, I do feel like I'm doing everything right. Best, Christian [1]: https://www.gnupg.org/documentation/manuals/gnupg/gpg_002dpreset_002dpassphrase.html