Saturday, September 5, 2009

Change GPG passphrase

When you create a new public/private key pair you are prompted to enter a passphrase. This passphrase is then used to unlock the private key. Now suppose that you chose a secure passphrase but maybe after a few years with the same key something happens and someone learns your passphrase. Instead of having to create a whole new key pair, you can change the passphrase relatively easily. Here is how you do it:
$ gpg --edit-key [keyID]
Command> passwd
Enter passphrase:
Enter the new passphrase for this secret key.
Enter passphrase:
Repeat passphrase:
Command> save
And thats it. Your secret key now uses the new passphrase.

7 comments:

  1. I know its an old post. But thanks. It helps alot

    ReplyDelete
  2. Helped me as well!! Thanks a lot!

    ReplyDelete
  3. Me too, guess it got pushed up in google results just recently.

    ReplyDelete
  4. Thanks from me too.

    ReplyDelete
  5. Thank you, I was looking exactly for this. Just let me add this: if someone gets acces to your encrypted private key AND learns the passphrase you must revoke the associated public key and generate a brand new keypair, not just simply change the passphrase ;)

    ReplyDelete

Note: Only a member of this blog may post a comment.