How to update GnuPG gpg key passwords
by Riley MacDonald, February 8, 2018

In an earlier post I described how to sign your git commits using GnuPG. This post describes how to update the gpg key password.

Find your key ID
Start by finding your key ID using the following command:

$ gpg --list-keys
gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2019-11-17
/Users/riley.macdonald/.gnupg/pubring.kbx
-----------------------------------------
pub   xxxXXXX 2017-11-17 [SC] [expires: 2019-11-17]
      0000000xxxxxx000000xxxxxx000000xxxxxx000
uid           [ultimate] Riley MacDonald <riley_macdonald@hotmail.com>
sub   xxxXXXX 2017-11-17 [E] [expires: 2019-11-17]

I’ve hidden my ID for this post. The ID is 0000000xxxxxx000000xxxxxx000000xxxxxx000 in this example.

Edit the key by ID
Now that you have the ID you can edit the key and change the password:

$ gpg --edit-key 0000000xxxxxx000000xxxxxx000000xxxxxx000
gpg> passwd
# follow the prompts and update the password
gpg> save

All set, your gpg password should be updated.

Open the comment form

Leave a comment:

Comments will be reviewed before they are posted.

User Comments:

How to update private ssh id_rsa key password - Riley MacDonald on 2018-07-11 12:49:11 said:
[…] Also see How to update GnuPG gpg key passwords […]