我已将我的 GPG 密钥从一台服务器复制到另一台服务器,在第一台服务器上一切正常,在新服务器上我得到以下内容:(我已包含 list-keys 和 list-secret-keys 的输出
[www@localhost data]$ gpg escs_hr_feed.pgp
You need a passphrase to unlock the secret key for
user: "Encrypt <[email protected]>"
2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24 (main key ID B943D3E2)
gpg: cancelled by user
gpg: encrypted with 2048-bit RSA key, ID 8E7BFE3A, created 2015-06-24
"Encrypt <[email protected]>"
gpg: public key decryption failed: General error
gpg: decryption failed: No secret key
[www@localhost data]$ gpg --list-keys
/home/www/.gnupg/pubring.gpg
----------------------------
pub 2048R/B943D3E2 2015-06-24
uid Encrypt <[email protected]>
uid Master <[email protected]>
sub 2048R/8E7BFE3A 2015-06-24
sub 2048R/6E704692 2015-06-24
[www@localhost data]$ gpg --list-secret-keys
/home/www/.gnupg/secring.gpg
----------------------------
sec 2048R/B943D3E2 2015-06-24
uid Master <[email protected]>
uid Encrypt <[email protected]>
ssb 2048R/8E7BFE3A 2015-06-24
ssb 2048R/6E704692 2015-06-24
答案1
所以问题竟然是,如果你sudo su -
给了用户,就不能使用gpg,需要直接以用户身份登录。
(至少在我公司的服务器设置上)