Cannot find "gpg-agent.conf" (to configure pinentry / unnatended passphrase)

Hi. I’ve created an unattended program to run automated encryption tasks using GPG.

I’ve encountered a problem with pinentry, because when gpg.exe is invoked in my program, pinentry-qt GUI pops up asking for the private key passphrase.

If I type it manually, it stays cached for maybe ten minutes and the program runs fine, but after that it’s requested again.

After digging a lot of forums and mailing lists, I found a couple of solutions which are not an option for me:

-Passing the password through a | pipe using --passphrase-fd 0
(I don’t want to harcode the passphrase).

-Removing the passphrase:
(I don’t want to do that either).

I found here a possible solution, setting “pinentry-timeout 0” in gpg-agent.conf so I only have to type it once after each server restart and then let the program run unattended.

In this wiki a different approach to the same issue is explained: GnuPG - ArchWiki

I also read about “–max-cache-ttl n” argument.

I could configure both to something high, like a year, so the passphrase doesn’t expire.

In this forum, this user also is trying to get an unattended password working PRESET_PASSPHRASE does not skip pinentry gui dialog

The problem is that gpg-agent.conf is not present in my computer, so I cannot edit it. I’ve checked “C:\Users\user\AppData\Roaming\gnupg” folder and the file is just not there or anywhere on my computer. I don’t know the formatting of the file, so I cannot create one from scratch.

Could you help me getting this working? I just need to enter the password once and let the server do it’s thing.

Thank you.

if there is no gpg.agent.conf, you can just create it with a text editor.


Is there any special formatting I should follow in terms of start/end of lines or delimitation?

Or just one row per configuration parameter?

this is in the documentation, e.g.
It may contain any valid long option; the leading two dashes may not be entered and the option may not be abbreviated.

So its one option per line, I don’t remember the line ending convention,
if windows line ending don’t work, try unix line endings. :slight_smile:

is a comment character.