malloc.3: Clarify that realloc() may move the memory block
[man-pages.git] / man7 / user-keyring.7
blob4b249d60d93e91cd332c008d9cb03439e005de23
1 .\" Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
2 .\" Written by David Howells (dhowells@redhat.com)
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
5 .\" This program is free software; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License
7 .\" as published by the Free Software Foundation; either version
8 .\" 2 of the License, or (at your option) any later version.
9 .\" %%%LICENSE_END
10 .\"
11 .TH USER-KEYRING 7 2020-08-13 Linux "Linux Programmer's Manual"
12 .SH NAME
13 user-keyring \- per-user keyring
14 .SH DESCRIPTION
15 The user keyring is a keyring used to anchor keys on behalf of a user.
16 Each UID the kernel deals with has its own user keyring that
17 is shared by all processes with that UID.
18 The user keyring has a name (description) of the form
19 .I _uid.<UID>
20 where
21 .I <UID>
22 is the user ID of the corresponding user.
23 .PP
24 The user keyring is associated with the record that the kernel maintains
25 for the UID.
26 It comes into existence upon the first attempt to access either the
27 user keyring, the
28 .BR user\-session\-keyring (7),
29 or the
30 .BR session\-keyring (7).
31 The keyring remains pinned in existence so long as there are processes
32 running with that real UID or files opened by those processes remain open.
33 (The keyring can also be pinned indefinitely by linking it
34 into another keyring.)
35 .PP
36 Typically, the user keyring is created by
37 .BR pam_keyinit (8)
38 when a user logs in.
39 .PP
40 The user keyring is not searched by default by
41 .BR request_key (2).
42 When
43 .BR pam_keyinit (8)
44 creates a session keyring, it adds to it a link to the user
45 keyring so that the user keyring will be searched when the session keyring is.
46 .PP
47 A special serial number value,
48 .BR KEY_SPEC_USER_KEYRING ,
49 is defined that can be used in lieu of the actual serial number of
50 the calling process's user keyring.
51 .PP
52 From the
53 .BR keyctl (1)
54 utility, '\fB@u\fP' can be used instead of a numeric key ID in
55 much the same way.
56 .PP
57 User keyrings are independent of
58 .BR clone (2),
59 .BR fork (2),
60 .BR vfork (2),
61 .BR execve (2),
62 and
63 .BR _exit (2)
64 excepting that the keyring is destroyed when the UID record is destroyed when
65 the last process pinning it exits.
66 .PP
67 If it is necessary for a key associated with a user to exist beyond the UID
68 record being garbage collected\(emfor example, for use by a
69 .BR cron (8)
70 script\(emthen the
71 .BR persistent\-keyring (7)
72 should be used instead.
73 .PP
74 If a user keyring does not exist when it is accessed, it will be created.
75 .SH SEE ALSO
76 .ad l
77 .nh
78 .BR keyctl (1),
79 .BR keyctl (3),
80 .BR keyrings (7),
81 .BR persistent\-keyring (7),
82 .BR process\-keyring (7),
83 .BR session\-keyring (7),
84 .BR thread\-keyring (7),
85 .BR user\-session\-keyring (7),
86 .BR pam_keyinit (8)