我制作了一个脚本,可以将我的 Keepass DB 自动备份到 Google Drive
所以首先它是加密的,但我也想签名
我使用了 2 个系统,一个 Mac Mini (Intel)(2c/2t,16G RAM)和一个 Ubuntu 20.04 VPS(8c/16t,16G RAM)
使用相同的命令:
gpg -vvv --yes --batch -r <REDACTED> --passphrase-file /home/stig124/pkx --output ~/bak/secbak-140421_20.tar.xz3 --encrypt --sign ~/bak/secbak-140421_2002.tar.xz
在 Mac 上,它工作得很好,但在 Ubuntu 上它总是失败,日志中什么也没说
gpg: using character set 'utf-8'
gpg: using pgp trust model
gpg: key 6CF8D3A4170BD77B: accepted as trusted key
gpg: using subkey 524151A99DEC9CA3 instead of primary key 6CF8D3A4170BD77B
gpg: automatically retrieved <REDACTED> via Local
gpg: This key belongs to us
gpg: writing to '/home/stig124/bak/secbak-140421_20.tar.xz3'
gpg: RSA/AES256 encrypted for: <REDACTED>"
它永远停在那里
删除签名可以解决问题,但我完全不知道为什么会失败,是否可以解决?
Ubuntu GPG 版本。2.2.19
(Ubuntu 20.04 存储库上最新可用)
gpg (GnuPG) 2.2.19
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /home/stig124/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
MacOS 11.2.3
GPG 版本。2.2.27
(最新的 GPG Suite 附带版本)
gpg (GnuPG) 2.2.27
libgcrypt 1.9.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /Users/stig124/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
答案1
gpg -vvv --yes --batch -r --passphrase-file /home/stig124/pkx --output ~/bak/secbak-140421_20.tar.xz3 --encrypt --sign ~/bak/secbak-140421_2002。压缩包
如果使用--passphrase-file
您还需要包括--pinentry-mode loopback
:
gpg -vvv --pinentry-mode loopback --yes --batch -r <REDACTED> --passphrase-file /home/stig124/pkx --output ~/bak/secbak-140421_20.tar.xz3 --encrypt --sign ~/bak/secbak-140421_2002.tar.xz