Changing GPG Password
Sometime ago I posted about GPG Key explaining how to generate, setup, backup and restore it. Now I would like to add something to it, recently I decided to change my key password and now I’m taking notes of the proccess in this post.
First find the key you want to change the password
$ gpg --list-keys
I particularly like to use --list-keys
with --keyid-format LONG
parameter, to get the long key id, which is easier to work with.
$ gpg --list-secret-keys --keyid-format LONG
[keyboxd]
---------
sec rsa4096/87C6D385122B1669 2017-12-04 [SC]
7D30FFF3FC256153A59AEA698726DF85922B8669
uid [ultimate] Fernando Bass (no comments) <xyz@mail.com>
ssb rsa4096/7A822B866BD5E7D1 2017-12-04 [E]
In this case, the key id is 87C6D385122B1669
.
Now lets change the password
$ gpg --edit-key 87C6D385122B1669
This will open the gpg
console, where you can change the password
gpg> passwd
If your key is protected, you will be asked to enter the current password, after that a prompt asking to type the new password and confirmation will be displayed.
If everything goes well, you should be redirect to the gpg
console, where you can save the changes.
gpg> save
Thats it, after save your changes you can start using your GPG Key with the new password.
Thank you