I use GPG keys to encrypt backups with duplicity, so I would like to export the key after it is generated, so I can move it to a backup location in case the server burst into flames.
Is there any way to export the secret key without user interaction? I can generate keys with this piece of documentation, but every time I try to export the key, it asks for password. I tried passing a environment variable like
PASSPHRASE or adding
--passphrase, but it still asks for the password.
Is this even possible or should I just copy the
.gnupg directory and backup that instead? Every server only has one GPG key.
Trying this on Ubuntu Server 18.04 with GPG 2.2.8, by the way.