Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that GnuPG is all about security, thus it's not giving many chance of retrieve private keys (otherwise anyone could do it) but I've got a private key, and my own rev.asc file.

I had to reinstall my Ubuntu box (former Ubuntu Studio) and I have backup of /home and /etc.

Is it possible to recover my GnuPG key instead of revoke it and create another one?

share|improve this question
up vote 5 down vote accepted

By default, GPG stores everything under the .gnupg directory in your home directory. (Your encrypted private key should be in ~/.gnupg/secring.gpg).

Restoring the entire ~/.gnupg directory from your backup will do the trick.

share|improve this answer
Thanks! Sadly, something must have gone wrong, because I cannot find my ~/.gnupg directory in the backup...probably I lost it before (or during) the disaster that lead me to the reinstall. – dag729 Oct 21 '10 at 12:24
@dag729: just in case you don't know this - ls will consider files and folders starting with a dot to be invisible. Use ls -a to show everything in the backup of your home directory. – Wim Coenen Oct 21 '10 at 12:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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