如何防止 gpg-agent 在密码收集期间超时?

rca*_*ell 7 encryption gnupg gpg-agent

gpg2在 CLI 脚本中调用本地文件的对称加密。它似乎gpg-agent通过一些 CLI、基于文本的 UI 提示输入密码。只要我在附近输入密码,一切正常。但是,如果我不是,它最终会失败并显示以下消息:

gpg-agent[15338]: command get_passphrase failed: Operation cancelled
gpg: cancelled by user
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of `XXXX.tar' failed: Operation cancelled
Run Code Online (Sandbox Code Playgroud)

有没有办法完全关闭这个超时?

我希望密码提示无限期地保留在屏幕上,直到我输入某些内容。

use*_*686 2

在 gpg-agent.conf (请参阅gpg-agent(1))中,尝试以下选项:

pinentry-timeout 0
pinentry-program /usr/bin/pinentry-curses --timeout 0
Run Code Online (Sandbox Code Playgroud)

(不过你可能会发现pinentry-tty使用起来更好一些。)