无法找到gpg-agent


11

在全新安装的Ubuntu 16.04上,我想使用gpg来加密数据库备份,但是我无法gpg-agent正常工作。

postgres@db:~$ gpg -s test.txt

You need a passphrase to unlock the secret key for
user: "Nicolas Remond <nicolas@xxx.com>"
2048-bit RSA key, ID F5DECA47, created 2016-11-03

gpg: gpg-agent is not available in this session
Enter passphrase: 

另外,似乎gpg-agent正在像我之前做的那样运行:

postgres@db:~$ gpg-agent
gpg-agent[1715]: no gpg-agent running in this session
postgres@db:~$ gpg-connect-agent /bye
gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to agent established
postgres@db:~$ pidof gpg-agent
1762

并且gpg config具有以下use-agent设置:

postgres@dbmaster0:~$ cat ~/.gnupg/gpg.conf | grep use-agent
# For Ubuntu we now use-agent by default to support more automatic
use-agent

我想念什么?


使用启动代理,--log-file [myfile]然后查看日志中是否给您任何错误。
拉尼兹'16

我收到的正确错误消息是gpg: gpg-agent is not available in this session。如果我有日志,您的建议是,我得到的是:2016-12-19 13:39:39 gpg-agent[10957] gpg-agent (GnuPG) 2.1.11 started
n1r3

我尝试手动设置GPG_AGENT_INFO,但我不知道如何知道要设置的内容……那是我得到的gpg: problem with the agent - disabling agent use
n1r3

作为超级用户,设置export GPG_AGENT_INFO=/var/lib/postgresql/.gnupg/S.gpg-agent:0:1有效,但不能作为用户使用。另外,似乎我必须手动执行该操作,不是吗?
n1r3

是否已按照_man gpg-agent页面中所述将此GPG_TTY = $(tty)导出GPG_TTY导出到您的.bashrc文件中?
乔治·乌德森

Answers:


13

如果有人卡住了,请回答我。

在Ubuntu 16.04上,默认版本为:

    # gpg --version
    gpg (GnuPG) 1.4.20

    # gpg-agent --version
    gpg-agent (GnuPG) 2.1.11

它们不兼容。必须使用GPG2:

    # gpg2 --version
    gpg (GnuPG) 2.1.11

0

解决方案是安装gpgv2

sudo apt install gpgv2

这是因为Ubuntu随附的gpg-agent是版本2,并且它尝试连接到版本2的gpg。但是Ubuntu已安装了gpg版本1。


3
可能是您的意思gnupg2
Dmitriusan '18
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.