December 8, 2022

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> 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:


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


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,,


I do self-funded research and I'm writing a book.

> What's the book about?

About technologies and agency.

Meaning, technologies can foster agency. No doubt. But I am also asking:

Can usage of technologies give us a sense of empowerment while in fact undermining our abilities?

I posted a summary of the prologue on the homepage:


gnu linux gpg personal computing command-line interface (cli) wiki office applications shell literacy

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88