0

I have a GPG key which I use to sign and submit packages to Launchpad.

Is it possible to reuse that key in another installation, or do I always have to create a new key for the new installation of a GNU/Linux operating system?

Archisman Panigrahi
  • 309
  • 1
  • 3
  • 15

2 Answers2

4

Rather than copying the ~/.gnupg folder, you can create an export of your secret keys and then import on the new install, e.g.

$ gpg --export-secret-keys --output mykeys

Then on the new system:

$ gpg --import mykeys

(note: you will need to know the password associated with the keys to import them)

By exporting and importing, you allow gpg to handle any version/format differences between differing versions of gpg on the different installs.

You can use the --export option for your stored public keys in the same manner. (though I have found not including the public keys as a good way to purge all the old, non-used keys that have been collected over the years if you don't explicitly need them)

David C. Rankin
  • 256
  • 1
  • 6
0

Copy ~/.gnupg to the new system

Ole Tange
  • 33,591
  • 31
  • 102
  • 198