GPG: Change the expiration date (time) of a GPG subkey
In the shell (the terminal), run:
$ gpg --list-keys
to print a list of all the keys if you don’t know the [key ID] of the key you want to change. [key ID] can be the full email address, part of the email address, part of the name.
Once you know the [key ID], run:
$ gpg --edit-key [key ID]
In your shell you should see a prompt:
gpg>
type:
gpg> key n
where n
is the subkey’s index. For instance, if the subkey whose expiration time you want to extend is the first listed subkey, or if it is the only listed subkey, then
the command to run would be:
gpg> key 1
You should see an asterisk appeding the subkey (i.e. ssb
): ssb*
.
To change the expiration time of the selected subkey, run:
gpg> expire
Follow the instructions to set the duration of the next expiration date. For example, if you want the key to expire in 2 yearsmonths type:
gpg> 2y
then save:
gpg> save
You are done. You can check the subkey expiration date by running:
$ gpg -k [key ID]
Further information from GnuPG’s manual:
--edit-key
Present a menu which enables you to do most of the key management related tasks. It expects the specification of a key on the command line.
key n
Toggle selection of subkey with index n or key ID n. Use * to select all and 0 to deselect all
expire
Change the key or subkey expiration time. If a subkey is selected, the expiration time of this subkey will be changed. With no selec- tion, the key expiration of the primary key is changed.
To display the manual of gpg
in your shell run:
$ man gpg
Sources: man gpg,
gnu linux gpg personal computing command-line interface (cli) wiki office applications shell literacy