Gpg
gpg-agent 正在執行,但總是提示我輸入密碼
當我執行 gpg2 時,每次使用時都會提示我輸入密碼。根據我對
gpg-agent
手冊頁的閱讀,我應該只在第一次得到提示。gpg-agent is a daemon to manage secret (private) keys independently from any proto-col. It is used as a backend for gpg and gpgsm as well as for a couple of other utilities. The agent is automatically started on demand by gpg, gpgsm, gpgconf, or gpg-connect-agent. Thus there is no reason to start it manually. ... --default-cache-ttl n Set the time a cache entry is valid to n seconds. The default is 600 sec- onds. Each time a cache entry is accessed, the entry's timer is reset. To set an entry's maximum lifetime, use max-cache-ttl. --max-cache-ttl n Set the maximum time a cache entry is valid to n seconds. After this time a cache entry will be expired even if it has been accessed recently or has been set using gpg-preset-passphrase. The default is 2 hours (7200 seconds).
如果我沒看錯,
gpg2
在我第一次使用它時呼叫應該提示輸入密碼,然後,如果我在接下來的 600 秒內再次執行它,我將不會再收到提示。跑步gpg2 --export-secret-keys --armor john.doe@example.com > /dev/null
給了我這個:
┌─┐ │ Please enter the passphrase to export the OpenPGP secret key: │ │ "John Doe (asdf) <john.doe@example.com>" │ │ 2048-bit RSA key, ID EB7B49EAD38DE665, │ │ created 2018-10-09. │ │ │ │ │ │ Passphrase: _ │ │ │ │ <OK> <Cancel> │ └─┘
正在執行的快速
ps aux
顯示:gpg-agent
ps aux | grep gpg-agent jdoe 14089 0.1 0.1 100884 3588 ? SLs 18:50 0:07 /usr/bin/gpg-agent --supervised
唉,此後立即再次執行
gpg2 --export-secret-keys...
再次提示我輸入密碼。更多細節:
- 我正在使用
pinentry-curses
- 我已經
$GPG_TTY
在我的.bashrc
gpg2 --version -> gpg (GnuPG) 2.2.4
- 我已經通讀了為什麼即使使用 gpg-agent 也會要求 gpg 輸入密碼?以及如何找出 gpg-agent 記憶體的密鑰?(比如 ssh-add -l 如何顯示記憶體的 ssh 密鑰),但我並沒有完全理解。
從 GnuPG 2.2.4 手冊中,關於
--export-secret-keys
(特別):GnuPG 可能會要求您輸入密鑰的密碼。這是必需的,因為密鑰的內部保護方法與 OpenPGP 協議規定的不同。