Debian Codegraph @

upstream/debian-unstable/man7/user-session-keyring.7

raw
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-session-keyring 7 2026-02-08 "Linux man-pages 6.18"
7 .SH NAME
8 user-session-keyring \- per-user default session keyring
9 .SH DESCRIPTION
10 The user session keyring is a keyring used to anchor keys on behalf of a user.
11 Each UID the kernel deals with has its own user session keyring that
12 is shared by all processes with that UID.
13 The user session keyring has a name (description) of the form
14 .I _uid_ses.<UID>
15 where
16 .I <UID>
17 is the user ID of the corresponding user.
18 .P
19 The user session keyring is associated with the record that
20 the kernel maintains for the UID.
21 It comes into existence upon the first attempt to access either the
22 user session keyring, the
23 .BR user\-keyring (7),
24 or the
25 .BR session\-keyring (7).
26 .\" Davis Howells: the user and user-session keyrings are managed as a pair.
27 The keyring remains pinned in existence so long as there are processes
28 running with that real UID or files opened by those processes remain open.
29 (The keyring can also be pinned indefinitely by linking it
30 into another keyring.)
31 .P
32 The user session keyring is created on demand when a thread requests it
33 or when a thread asks for its
34 .BR session\-keyring (7)
35 and that keyring doesn't exist.
36 In the latter case, a user session keyring will be created and,
37 if the session keyring wasn't to be created,
38 the user session keyring will be set as the process's actual session keyring.
39 .P
40 The user session keyring is searched by
41 .BR request_key (2)
42 if the actual session keyring does not exist and is ignored otherwise.
43 .P
44 A special serial number value,
45 .BR KEY_SPEC_USER_SESSION_KEYRING ,
46 is defined
47 that can be used in lieu of the actual serial number of
48 the calling process's user session keyring.
49 .P
50 From the
51 .BR keyctl (1)
52 utility,
53 .RB ' @us '
54 can be used instead of a numeric key ID in much the same way.
55 .P
56 User session keyrings are independent of
57 .BR clone (2),
58 .BR fork (2),
59 .BR vfork (2),
60 .BR execve (2),
61 and
62 .BR _exit (2)
63 excepting that the keyring is destroyed when the UID record is destroyed
64 when the last process pinning it exits.
65 .P
66 If a user session keyring does not exist when it is accessed,
67 it will be created.
68 .P
69 Rather than relying on the user session keyring,
70 it is strongly recommended\[em]especially if the process
71 is running as root\[em]that a
72 .BR session\-keyring (7)
73 be set explicitly, for example by
74 .BR pam_keyinit (8).
75 .SH NOTES
76 The user session keyring was added to support situations where
77 a process doesn't have a session keyring,
78 perhaps because it was created via a pathway that didn't involve PAM
79 (e.g., perhaps it was a daemon started by
80 .BR inetd (8)).
81 In such a scenario, the user session keyring acts as a substitute for the
82 .BR session\-keyring (7).
83 .SH SEE ALSO
84 .ad l
85 .nh
86 .BR keyctl (1),
87 .BR keyctl (3),
88 .BR keyrings (7),
89 .BR persistent\-keyring (7),
90 .BR process\-keyring (7),
91 .BR session\-keyring (7),
92 .BR thread\-keyring (7),
93 .BR user\-keyring (7)