What are the critical files I need to backup from gpg? I guess my private key would qualify of course... but what else?


The most critical are your secret/private keys:

gpg --export-secret-keys > secret-backup.gpg

secret-backup.gpg is then the file to keep safe.

Otherwise the ~/.gnupg/ directory contain all private and public keys(secring.gpg and pubring.gpg respectively) as well as configuration and trustdb which could be convenient to have stored.

  • If a public key was lost, would the private key be useless? – Buttons840 May 4 at 15:49
  • @Buttons840 The public key is a subset of the private key so you should be able to extract the public key from the private. – hultqvist May 4 at 18:21

The easiest way would be to grab the entire GnuPG directory - usually ~/.gnupg/, it contains all private keys you have, as well as the public keyring and other useful data (trustdb, etc.)


You definitely want to backup your private key and the revocation file you created.

  • where is the "revocation certificate" ? – jldupont Nov 18 '09 at 22:07
  • You need to create it (if you didn't already). It is used to revoke your key if you loose your private key. – PEra Nov 24 '09 at 18:17

You may also want to back up any keys you've signed or ones you don't feel like re-downloading off the key servers.

At a minimum, all you need is your complete key.

  • ...and any revocation certificates you created. – Broam Nov 18 '09 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.