Summary
Suppose you get along with GPG (The GNU Privacy Guard, GnuPG) for good privacy, and sometimes want to change the passphrase of its secret key.
This post shows how to do it.
To be short:
- Get the secret key ID
- Run
gpg --edit-key ${the-key}
to start the prompt - Run
passwd
Environment
- OS: Devuan 5 - Daedalus
- Desktop Environment: Xfce 4.16
- Cryptographic Software: GPG 2.2.40
Description
First, get the secret key ID by running:
$ gpg --list-secret-keys --keyid-format=long
It will print out like below:
/home/${USER}/.gnupg/pubring.kbx
---------------------------------
sec rsa4096/${KEY:LIKE-123ABC456DEF} 202X-XX-XX [SC]
${HASH}
uid [...] ${NAME} <${EMAIL}>
ssb rsa4096/${SUBKEY} 202X-XX-XX [E]
Get the key in sec
.
Next, run gpg
with --edit-key
option and the key:
$ gpg --edit-key ${KEY:LIKE-123ABC456DEF}
Then it will show information on the key like below and start the prompt:
gpg (GnuPG) 2.2.40; Copyright (C) 2022 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
sec rsa4096/${KEY:LIKE-123ABC456DEF}
created: 202X-XX-XX expires: never usage: SC
trust: unknown validity: unknown
ssb rsa4096/${SUBKEY}
created: 202X-XX-XX expires: never usage: E
[...] (1). ${NAME} <${EMAIL}>
gpg>
Type as below:
gpg> passwd
The current passphrase will be required:
Finally, fill the new passphrases:
Done without any output if there is no error.
You can exit with:
gpg> quit
Conclusion
This is how to change the password on GPG.
Wish you privacy protected well 😉