Section: Linux Programmer's Manual (7)
persistent-keyring - per-user persistent keyring
The persistent keyring is a keyring used to anchor keys on behalf of a user.
Each UID the kernel deals with has its own persistent keyring that
is shared between all threads owned by that UID.
The persistent keyring has a name (description) of the form
is the user ID of the corresponding user.
The persistent keyring may not be accessed directly,
even by processes with the appropriate UID.
Instead, it must first be linked to one of a process's keyrings,
before that keyring can access the persistent keyring
by virtue of its possessor permits.
This linking is done with the
If a persistent keyring does not exist when it is accessed by the
operation, it will be automatically created.
Each time the
operation is performed,
the persistent key's expiration timer is reset to the value in:
Should the timeout be reached,
the persistent keyring will be removed and
everything it pins can then be garbage collected.
The key will then be re-created on a subsequent call to
The persistent keyring is not directly searched by
it is searched only if it is linked into one of the keyrings
that is searched by
The persistent keyring is independent of
It persists until its expiration timer triggers,
at which point it is garbage collected.
This allows the persistent keyring to carry keys beyond the life of
the kernel's record of the corresponding UID
(the destruction of which results in the destruction of the
The persistent keyring can thus be used to
hold authentication tokens for processes that run without user interaction,
such as programs started by
The persistent keyring is used to store UID-specific objects that
themselves have limited lifetimes (e.g., kerberos tokens).
If those tokens cease to be used
(i.e., the persistent keyring is not accessed),
then the timeout of the persistent keyring ensures that
the corresponding objects are automatically discarded.
library provides the
function for manipulating persistent keyrings.
(This function is an interface to the
This operation allows the calling thread to get the persistent keyring
corresponding to its own UID or, if the thread has the
capability, the persistent keyring corresponding to some other UID
in the same user namespace.
Each user namespace owns a keyring called
that contains links to all of the persistent keys in that namespace.
keyring can be seen when reading the contents of the
file for the UID 0 in the namespace.)
operation looks for a key with a name of the form
in that keyring,
creates the key if it does not exist, and links it into the keyring.
This page is part of release 4.16 of the Linux
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at