使用gpg中遇到problem with the agent: No pinentry

新安装的最小化centos8系统在gpg对称加密文档时,使用中遇到如下问题:

[root@centos ~]# gpg -c test 
gpg: problem with the agent: No pinentry
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of 'test' failed: Operation cancelled

网上查看参考资料,有推荐使用uset DISPLAY,尝试了一下还是不行。
前辈们的方案提供我了一个思路。
我拿centos7和centos8系统进行了比较:

centos7使用gpg会自动创建一下目录

[oot@centos7 ~ ]#rpm -qf `which gpg`
gnupg2-2.0.22-5.el7_5.x86_64

[root@centos7 ~ ]#ll ~/.gnupg/
total 12
-rw-------. 1 root root 7680 Dec  5 23:57 gpg.conf
drwx------. 2 root root    6 Dec  5 23:57 private-keys-v1.d
-rw-------. 1 root root    0 Dec  5 23:57 pubring.gpg
-rw-------. 1 root root  600 Dec  5 23:57 random_seed
srwxr-xr-x. 1 root root    0 Dec  5 23:57 S.gpg-agent

centos8使用gpg会自动创建一下目录

[root@centos8 ~ ]#rpm -qf `which gpg`
gnupg2-2.2.9-1.el8.x86_64
[root@centos8 ~ ]#ll ~/.gnupg/
total 8
drwx------. 2 root root   6 Dec  5 22:34 private-keys-v1.d
-rw-------. 1 root root  32 Dec  5 22:34 pubring.kbx
-rw-------. 1 root root 600 Dec  5 23:18 random_seed

拿能正常打开窗口的Centos8对比

正常:
[root@centos8 ~ ]#ls /usr/bin/ | grep pinentry
pinentry
pinentry-curses          
[root@centos8 ~ ]#which pinentry
/usr/bin/pinentry
[root@centos8 ~ ]#rpm -qf `which pinentry`
pinentry-1.1.0-2.el8.x86_64
有问题的
[root@centos ~]# ls /usr/bin/ | grep pinentry
[root@centos ~]# rpm -q pinentry-1.1.0-2.el8.x86_64
package pinentry-1.1.0-2.el8.x86_64 is not installed
[root@centos ~]# yum install pinentry -y

安装pinentry包文件后恢复。

参考链接:
https://qastack.cn/superuser/520980/how-to-force-gpg-to-use-console-mode-pinentry-to-prompt-for-passwords

猜你喜欢

转载自blog.csdn.net/weixin_50904580/article/details/110729401