我已经将我的 PGP 密钥对复制到新安装的 ubuntu 服务器上。但它们不起作用:尝试解密文件时出现“操作已取消”错误:
$ echo TEST | gpg -e -a -r [email protected] > test.gpg
$ gpg -d < test.gpg
gpg: encrypted with 1024-bit ELG key, ID CBABC188BB23CD11, created 2003-05-22
"Emanuele Paolini <[email protected]>"
gpg: public key decryption failed: Operation cancelled
gpg: decryption failed: No secret key
$ gpg --list-secret-keys
/home/paolini/.gnupg/pubring.gpg
--------------------------------
sec dsa1024 2003-05-22 [SC]
848EA2CE420E06FF22E88DED7F0D73E98288DA05
uid [ultimate] Emanuele Paolini <[email protected]>
uid [ultimate] Emanuele Paolini <[email protected]>
uid [ultimate] Emanuele Paolini <[email protected]>
uid [ultimate] Emanuele Paolini <[email protected]>
uid [ultimate] Emanuele Paolini <[email protected]>
ssb elg1024 2003-05-22 [E]
相同的命令在我的个人电脑上运行良好。
- 也许复制钥匙时出了问题?
- 也许 ssh 连接有问题?
更新 问题与 ssh 连接有关。事实上,如果我尝试从服务器控制台执行命令,它会正常工作(打开一个窗口要求输入密码)...所以它与 pinentry 有关。我的 ssh 连接已启用 X 并正常工作。
更新 2
我尝试按照@Olivier的建议更改 pinentry 替代方案。我只能在pinentry-gnome3
(默认) 和之间进行选择pinentry-cursers
。我选择了后者,但不幸的是,我收到了错误“设备的 ioctl 不合适”...
答案1
解决方案:
sudo update-alternatives --config pinentry
选择pinentry-curses
或pinentry-tty
替代方案。