GPG Change Passphrase Secret Key Password Command


know how to cange a passphrase for openssh using ssh-keygen command. How do I change a GPG encryption key’s passphrase on Linux or Unix like operating systems? How do I change the passphrase of the secret key using gpg?


gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. You can use the gpg command for complete key management including setting up keys, change key passphrase, list keys and much more.

Change the passphrase of the secret key

The syntax is:

gpg –edit-key Your-Key-ID-Here

gpg> passwd

gpg> save


You need type the passwd command followed by the save command at gpg> prompt to change the passphrase for your key-ID.


First, list your keys with the following command:

gpg –list-keys

Sample outputs:


pub   4096R/9AABBCD8 2013-10-04

uid                  Home Nas Server (Home Nas Server Backup)

sub   4096R/149D60C7 2013-10-04

You need to note down the public key 9AABBCD8. Next, type the following command:

gpg –edit-key 9AABBCD8

Sample outputs:

gpg (GnuPG) 1.4.12; Copyright (C) 2012 Free Software Foundation, Inc.

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.

pub  4096R/9AABBCD8  created: 2013-10-04  expires: never       usage: SC

trust: ultimate      validity: ultimate

sub  4096R/149D60C7  created: 2013-10-04  expires: never       usage: E

[ultimate] (1). Home Nas Server (Home Nas Server Backup)


Type the passwd command at gpg> prompt to change the passphrase:

gpg> passwd

You need to supply old passphrase to unlock the secret key:

Key is protected.

You need a passphrase to unlock the secret key for

user:  Home Nas Server (Home Nas Server Backup)

4096-bit RSA key, ID 9AABBCD8, created 2013-10-04


Finally, enter the new passphrase:

Enter the new passphrase for this secret key.

Enter passphrase: TYPE-YOUR-new-PASSPHRASE-HERE

Repeat passphrase: again-TYPE-YOUR-new-PASSPHRASE-HERE

To save all changes to the key rings and quit, type save at gpg> prompt:

gpg> save

For more information read gpg(1) man page.



Leave a Reply

Your email address will not be published. Required fields are marked *