1USER-SESSION-KEYRING(7)    Linux Programmer's Manual   USER-SESSION-KEYRING(7)
2
3
4

NAME

6       user-session-keyring - per-user default session keyring
7

DESCRIPTION

9       The  user session keyring is a keyring used to anchor keys on behalf of
10       a user.  Each UID the kernel  deals  with  has  its  own  user  session
11       keyring  that  is shared by all processes with that UID.  The user ses‐
12       sion keyring has a name (description) of the form _uid_ses.<UID>  where
13       <UID> is the user ID of the corresponding user.
14
15       The  user session keyring is associated with the record that the kernel
16       maintains for the UID.  It comes into existence upon the first  attempt
17       to  access either the user session keyring, the user-keyring(7), or the
18       session-keyring(7).  The keyring remains pinned in existence so long as
19       there are processes running with that real UID or files opened by those
20       processes remain open.  (The keyring can also be pinned indefinitely by
21       linking it into another keyring.)
22
23       The user session keyring is created on demand when a thread requests it
24       or when a thread asks  for  its  session-keyring(7)  and  that  keyring
25       doesn't exist.  In the latter case, a user session keyring will be cre‐
26       ated and, if the session keyring wasn't to be created, the user session
27       keyring will be set as the process's actual session keyring.
28
29       The  user  session  keyring is searched by request_key(2) if the actual
30       session keyring does not exist and is ignored otherwise.
31
32       A special serial number value,  KEY_SPEC_USER_SESSION_KEYRING,  is  de‐
33       fined that can be used in lieu of the actual serial number of the call‐
34       ing process's user session keyring.
35
36       From the keyctl(1) utility, '@us' can be used instead of a numeric  key
37       ID in much the same way.
38
39       User  session  keyrings are independent of clone(2), fork(2), vfork(2),
40       execve(2), and _exit(2) excepting that the keyring  is  destroyed  when
41       the UID record is destroyed when the last process pinning it exits.
42
43       If  a  user session keyring does not exist when it is accessed, it will
44       be created.
45
46       Rather than relying on the user session keyring, it is strongly  recom‐
47       mended—especially  if  the  process  is  running  as  root—that  a ses‐
48       sion-keyring(7) be set explicitly, for example by pam_keyinit(8).
49

NOTES

51       The user session keyring  was  added  to  support  situations  where  a
52       process  doesn't have a session keyring, perhaps because it was created
53       via a pathway that didn't involve PAM (e.g., perhaps it  was  a  daemon
54       started  by  inetd(8)).   In  such a scenario, the user session keyring
55       acts as a substitute for the session-keyring(7).
56

SEE ALSO

58       keyctl(1), keyctl(3), keyrings(7), persistent-keyring(7),
59       process-keyring(7), session-keyring(7), thread-keyring(7),
60       user-keyring(7)
61

COLOPHON

63       This page is part of release 5.12 of the Linux man-pages project.  A
64       description of the project, information about reporting bugs, and the
65       latest version of this page, can be found at
66       https://www.kernel.org/doc/man-pages/.
67
68
69
70Linux                             2020-08-13           USER-SESSION-KEYRING(7)
Impressum