ccp*_*zza 97 linux ssh terminal console gnupg
在基于控制台的环境(例如 ssh 会话)中使用 gpg 会失败,因为 GTK pinentry 对话框无法在 SSH 会话中显示。
我试过了,unset DISPLAY但没有帮助。GPG 命令行选项不包括用于强制 pinentry 进入控制台模式的开关。
较旧的 GPG 版本提供了基于文本的提示,该提示在 SSH 会话中运行良好,但升级后却失败了。
有--textmode命令行开关,但显然,它还有其他作用。
为远程会话获取纯文本 pin 条目的正确和干净的方法是什么?
use*_*686 115
要永久更改 pinentry,请将以下内容附加到您的~/.gnupg/gpg-agent.conf:
pinentry-program /usr/bin/pinentry-tty
Run Code Online (Sandbox Code Playgroud)
(在缺少 pinentry-tty 的旧版本中,将 pinentry-curses 用于“完整终端”对话窗口。)
告诉 GPG 代理重新加载配置:
gpg-connect-agent reloadagent /bye
Run Code Online (Sandbox Code Playgroud)
Joh*_*den 15
在 debian 机器上:
sudo apt install pinentry-tty
sudo update-alternatives --config pinentry
Run Code Online (Sandbox Code Playgroud)
(并将其设置为 pinentry-tty)
rac*_*tup 10
我只是在 Ubuntu 16.04.3 上遇到了这个问题,当我尝试在没有密码的系统帐户上和通过 ssh 的用户帐户上使用 gpg2 (2.1.11) 生成/安装私钥时。没有任何工作给予:
gpg:密钥 FE17AE6D/FE17AE6D:发送给代理的错误:权限被拒绝
gpg:构建 skey 数组时出错:权限被拒绝
然后我发现这对我有用,简而言之:
pico ~/.gnupg/gpg-agent.conf
# add: allow-loopback-pinentry
gpg-connect-agent reloadagent /bye
gpg2 --pinentry-mode loopback --import private.key
Run Code Online (Sandbox Code Playgroud)
Roc*_* W. 10
在 Ubuntu 18.04 上,默认安装 gpg 2.2.4,我有
/usr/bin/pinentry
/usr/bin/pinentry-gnome3
/usr/bin/pinentry-gtk-2
/usr/bin/pinentry-x11
Run Code Online (Sandbox Code Playgroud)
我能够执行以下操作以获得基于文本的 PIN 条目:
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
Run Code Online (Sandbox Code Playgroud)
小智 7
如果没有,请pinentry-curses使用 yum 或 apt-get安装。
然后,运行:
sudo update-alternatives --config pinentry
并从列表中选择 pinentry-curses。
我将从这里复制我的答案......
看着man pinentry-gnome3,我看到了这个:
pinentry-gnome3 implements a PIN entry dialog based on GNOME 3, which
aims to follow the GNOME Human Interface Guidelines as closely as pos?
sible. If the X Window System is not active then an alternative text-
mode dialog will be used. There are other flavors that implement PIN
entry dialogs using other tool kits.
Run Code Online (Sandbox Code Playgroud)
不幸的是,这种文本模式回退对我不起作用。似乎其他人也有同样的 问题。然而,这条评论促使我尝试了一个不同的 GUI 引脚输入程序:pinentry-gtk2. 你可以这样切换:
> sudo update-alternatives --config pinentry
There are 3 choices for the alternative pinentry (providing /usr/bin/pinentry).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/pinentry-gnome3 90 auto mode
1 /usr/bin/pinentry-curses 50 manual mode
2 /usr/bin/pinentry-gnome3 90 manual mode
3 /usr/bin/pinentry-gtk-2 85 manual mode
Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/pinentry-gtk-2 to provide /usr/bin/pinentry (pinentry) in manual mode
Run Code Online (Sandbox Code Playgroud)
一旦我切换,它对我来说非常有效!在桌面上的终端中,它将使用 GUI 密码条目,但是当我 ssh 进入我的机器时,它将使用文本模式密码条目。
不确定这个问题最初是关于哪个版本的 GPG。我在 (K)ubuntu 20.04 LTS Focal 中使用 GPG v2.2.19。我所需要添加的只是--pinentry-mode loopback它开始在 TTY 中要求输入密码。我不需要安装任何东西。例如:
gpg --pinentry-mode loopback --export-secret-keys -a | less
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
88757 次 |
| 最近记录: |