man-pages/man7/user-session-keyring.7.html
2021-03-31 01:06:50 +01:00

166 lines
5.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of USER-SESSION-KEYRING</TITLE>
</HEAD><BODY>
<H1>USER-SESSION-KEYRING</H1>
Section: Linux Programmer's Manual (7)<BR>Updated: 2017-03-13<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
user-session-keyring - per-user default session keyring
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
The user session keyring is a keyring used to anchor keys on behalf of a user.
Each UID the kernel deals with has its own user session keyring that
is shared by all processes with that UID.
The user session keyring has a name (description) of the form
<I>_uid_ses.&lt;UID&gt;</I>
where
<I>&lt;UID&gt;</I>
is the user ID of the corresponding user.
<P>
The user session keyring is associated with the record that
the kernel maintains for the UID.
It comes into existence upon the first attempt to access either the
user session keyring, the
<B><A HREF="/cgi-bin/man/man2html?7+user-keyring">user-keyring</A></B>(7),
or the
<B><A HREF="/cgi-bin/man/man2html?7+session-keyring">session-keyring</A></B>(7).
The keyring remains pinned in existence so long as there are processes
running with that real UID or files opened by those processes remain open.
(The keyring can also be pinned indefinitely by linking it
into another keyring.)
<P>
The user session keyring is created on demand when a thread requests it
or when a thread asks for its
<B><A HREF="/cgi-bin/man/man2html?7+session-keyring">session-keyring</A></B>(7)
and that keyring doesn't exist.
In the latter case, a user session keyring will be created and,
if the session keyring wasn't to be created,
the user session keyring will be set as the process's actual session keyring.
<P>
The user session keyring is searched by
<B><A HREF="/cgi-bin/man/man2html?2+request_key">request_key</A></B>(2)
if the actual session keyring does not exist and is ignored otherwise.
<P>
A special serial number value,
<B>KEY_SPEC_USER_SESSION_KEYRING</B>,
is defined
that can be used in lieu of the actual serial number of
the calling process's user session keyring.
<P>
From the
<B><A HREF="/cgi-bin/man/man2html?1+keyctl">keyctl</A></B>(1)
utility, '<B>@us</B>' can be used instead of a numeric key ID in
much the same way.
<P>
User session keyrings are independent of
<B><A HREF="/cgi-bin/man/man2html?2+clone">clone</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+vfork">vfork</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2),
and
<B><A HREF="/cgi-bin/man/man2html?2+_exit">_exit</A></B>(2)
excepting that the keyring is destroyed when the UID record is destroyed
when the last process pinning it exits.
<P>
If a user session keyring does not exist when it is accessed,
it will be created.
<P>
Rather than relying on the user session keyring,
it is strongly recommended---especially if the process
is running as root---that a
<B><A HREF="/cgi-bin/man/man2html?7+session-keyring">session-keyring</A></B>(7)
be set explicitly, for example by
<B><A HREF="/cgi-bin/man/man2html?8+pam_keyinit">pam_keyinit</A></B>(8).
<A NAME="lbAD">&nbsp;</A>
<H2>NOTES</H2>
The user session keyring was added to support situations where
a process doesn't have a session keyring,
perhaps because it was created via a pathway that didn't involve PAM
(e.g., perhaps it was a daemon started by
<B><A HREF="/cgi-bin/man/man2html?8+inetd">inetd</A></B>(8)).
In such a scenario, the user session keyring acts as a substitute for the
<B><A HREF="/cgi-bin/man/man2html?7+session-keyring">session-keyring</A></B>(7).
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+keyctl">keyctl</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+keyctl">keyctl</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?7+keyrings">keyrings</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+persistent-keyring">persistent-keyring</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+process-keyring">process-keyring</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+session-keyring">session-keyring</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+thread-keyring">thread-keyring</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+user-keyring">user-keyring</A></B>(7)
<A NAME="lbAF">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="3"><A HREF="#lbAD">NOTES</A><DD>
<DT id="4"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="5"><A HREF="#lbAF">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:10 GMT, March 31, 2021
</BODY>
</HTML>