gpg 按需启动 gpg-agent?

mic*_*has 13 arch-linux debian gpg gpg-agent

手册页gpg-agent状态:

   The agent is usualy started on demand by gpg,  gpgsm,  gpgconf  or
   gpg-connect-agent.   Thus there is no reason to start it manually.
   In case you want to use the included Secure Shell  Agent  you  may
   start the agent using:

     gpg-connect-agent /bye

   The usual way to run the agent is from the ~/.xsession file:

     eval $(gpg-agent --daemon)
Run Code Online (Sandbox Code Playgroud)

这一方面告诉我“没有理由手动启动它”,另一方面告诉我如何手动启动它。——我是不是误会了什么?

在我的系统上,我似乎必须手动启动它。否则例如gpg-connect-agent抱怨:can't connect to the agent: IPC connect call failed。- 我是否需要gpg-connect-agent按照手册页中的说明配置任何内容来启动代理?


手册页也gpg-connect-agent说:

   --agent-program file
          Specify the agent program to be started if none is running.
Run Code Online (Sandbox Code Playgroud)

但是gpg-connect-agent --help没有列出这个选项,如果我尝试使用它,命令也会抱怨。

似乎手册页描述了一个不同的命令,或者我错过了什么重要的东西?


我的系统是当前的 Arch Linux。(在另一个 debian 机器上的情况相同。)

要求的详细信息:

$ gpg --version
gpg (GnuPG) 2.0.22
libgcrypt 1.5.3
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ?, ?
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
$ gpg-connect-agent --version
gpg-connect-agent (GnuPG) 2.0.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
$ man gpg-connect-agent |grep -A1 agent-program
       --agent-program file
              Specify the agent program to be started if none is running.
$ gpg-connect-agent --agent-program foo
gpg-connect-agent: invalid option "--agent-program"
$ gpg-connect-agent /bye
gpg-connect-agent: can't connect to the agent: IPC connect call failed
Run Code Online (Sandbox Code Playgroud)

Hau*_*ing 5

这是手册页中的糟糕措辞。我猜它的意思是:“您不必手动启动 gpg-agent。” 这是有道理的,因为 GnuPG 2.x 需要gpg-agent而它在 1.x 中是可选的

所以:“因此没有理由手动启动它”“......为了让工具运行”。

但是:如果您想要缓存功能,则gpg-agent必须作为守护程序运行,因此必须在工具之前启动,即手动启动或从工具启动,~/.xsession因为工具会寻找环境变量GPG_AGENT_INFO以找到(正确的)正在运行的gpg-agent. 如果工具启动,gpg-agent则在工具gpg-agent退出时退出。

gpg-connect-agent /bye可能是手册页中的一个真正的错误。AFAIK 这用于测试是否gpg-agent正在运行但不用于启动它。它甚至不能那样工作,因为您必须使用 shell(更准确地说:要启动的工具的父进程)来设置GPG_AGENT_INFO.