gpg-agent具体配置


  gpg(gnupg)工具使用很广泛,在前面一篇文章中就具体介绍:http://blog.csdn.net/dongtingzhizi/article/details/26362205,有一个问题值得关注,那就是使用GPG私钥时须要输入password。假设仅仅使用一次倒好说,仅仅须要输入一次password就好,可是假设须要批量使用,那就麻烦了!比如。近期的工作中。创建debian软件仓库须要使用gpg对deb包进行签名,增加上千个包须要输入上千次password。显然没法做到。此时就要用到gpg-agent了!

  网上关于gpg-agent的配置很少,这里有一篇介绍比較靠谱的能够參考:

https://wiki.archlinux.org/index.php/GnuPG#gpg-agent

  主要配置:

  1. 启动脚本(.profile或者~/.bash_profile)中配置:

eval $(gpg-agent --daemon) &
  2. ~/.gnupg/gpg-agent.conf中配置:
default-cache-ttl 3600   # password有效时间
pinentry-program /usr/bin/pinentry-gtk-2   # password输入窗体程序



  另外,须要注意,ubuntu中默认会有gnome-keyring-common接管password输入(默认包含ssh, gpg等,能够查看/etc/xdg/autostart文件夹中的相关文件),假设gpgpassword使用gpg-agent接管的话,须要把gnome-keyring-common中接管的gpg屏蔽掉,这篇文章中就具体的介绍:

https://wiki.archlinux.org/index.php/GnuPG#gpg-agent

  事实上非常easy。仅仅须要将/etc/xdg/autostart/gnome-keyring-gpg.desktop文件转移或者链接到/dev/null就可以。




原文地址:https://www.cnblogs.com/bhlsheji/p/5224877.html