
我已將 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
替代方案。