| 1 |
.\" Copyright 2014, Red Hat, Inc. |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
.\" |
| 6 |
.TH user-keyring 7 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
user-keyring \- per-user keyring |
| 9 |
.SH DESCRIPTION |
| 10 |
The user keyring is a keyring used to anchor keys on behalf of a user. |
| 11 |
Each UID the kernel deals with has its own user keyring that |
| 12 |
is shared by all processes with that UID. |
| 13 |
The user keyring has a name (description) of the form |
| 14 |
.I _uid.<UID> |
| 15 |
where |
| 16 |
.I <UID> |
| 17 |
is the user ID of the corresponding user. |
| 18 |
.P |
| 19 |
The user keyring is associated with the record that the kernel maintains |
| 20 |
for the UID. |
| 21 |
It comes into existence upon the first attempt to access either the |
| 22 |
user keyring, the |
| 23 |
.BR user\-session\-keyring (7), |
| 24 |
or the |
| 25 |
.BR session\-keyring (7). |
| 26 |
The keyring remains pinned in existence so long as there are processes |
| 27 |
running with that real UID or files opened by those processes remain open. |
| 28 |
(The keyring can also be pinned indefinitely by linking it |
| 29 |
into another keyring.) |
| 30 |
.P |
| 31 |
Typically, the user keyring is created by |
| 32 |
.BR pam_keyinit (8) |
| 33 |
when a user logs in. |
| 34 |
.P |
| 35 |
The user keyring is not searched by default by |
| 36 |
.BR request_key (2). |
| 37 |
When |
| 38 |
.BR pam_keyinit (8) |
| 39 |
creates a session keyring, it adds to it a link to the user |
| 40 |
keyring so that the user keyring will be searched when the session keyring is. |
| 41 |
.P |
| 42 |
A special serial number value, |
| 43 |
.BR KEY_SPEC_USER_KEYRING , |
| 44 |
is defined that can be used in lieu of the actual serial number of |
| 45 |
the calling process's user keyring. |
| 46 |
.P |
| 47 |
From the |
| 48 |
.BR keyctl (1) |
| 49 |
utility, |
| 50 |
.RB ' @u ' |
| 51 |
can be used instead of a numeric key ID in |
| 52 |
much the same way. |
| 53 |
.P |
| 54 |
User keyrings are independent of |
| 55 |
.BR clone (2), |
| 56 |
.BR fork (2), |
| 57 |
.BR vfork (2), |
| 58 |
.BR execve (2), |
| 59 |
and |
| 60 |
.BR _exit (2) |
| 61 |
excepting that the keyring is destroyed when the UID record is destroyed when |
| 62 |
the last process pinning it exits. |
| 63 |
.P |
| 64 |
If it is necessary for a key associated with a user to exist beyond the UID |
| 65 |
record being garbage collected\[em]for example, for use by a |
| 66 |
.BR cron (8) |
| 67 |
script\[em]then the |
| 68 |
.BR persistent\-keyring (7) |
| 69 |
should be used instead. |
| 70 |
.P |
| 71 |
If a user keyring does not exist when it is accessed, it will be created. |
| 72 |
.SH SEE ALSO |
| 73 |
.ad l |
| 74 |
.nh |
| 75 |
.BR keyctl (1), |
| 76 |
.BR keyctl (3), |
| 77 |
.BR keyrings (7), |
| 78 |
.BR persistent\-keyring (7), |
| 79 |
.BR process\-keyring (7), |
| 80 |
.BR session\-keyring (7), |
| 81 |
.BR thread\-keyring (7), |
| 82 |
.BR user\-session\-keyring (7), |
| 83 |
.BR pam_keyinit (8) |