user-session-keyring man page

user session keyring — Per-user default session keyring

Description

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. This keyring is associated with the record that the kernel maintains for the UID and, once created, is retained as long as that record persists. It is shared amongst all processes of that UID.

The user session keyring is created on demand when a thread requests it or when a thread asks for its session keyring and that 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.

The user session keyring is searched by request_key() if the actual session keyring does not exist and is ignored otherwise.

A special serial number value, KEY_SPEC_USER_SESSION_KEYRING, is defined that can be used in lieu of the calling process's user session keyring's actual serial number.

From the keyctl utility, '@us' can be used instead of a numeric key ID in much the same way.

User session keyrings are independent of clone(), fork(), vfork(), execve() and exit() excepting that the keyring is destroyed when the UID record is destroyed when the last process pinning it exits.

If a user session keyring does not exist when it is accessed, it will be created.

It is strongly recommended that a session keyring be set explicitly, for example by pam_keyinit, rather than relying on the user session keyring - particularly if a process is running as root.

See Also

keyctl(1),
keyctl(3),
keyrings(7),
process-keyring(7),
session-keyring(7),
thread-keyring(7),
user-keyring(7),
persistent-keyring(7)

Referenced By

keyctl_join_session_keyring(3), keyctl_session_to_parent(3), keyrings(7), keyutils(7), persistent-keyring(7), process-keyring(7), session-keyring(7), thread-keyring(7), user-keyring(7).

20 Feb 2014 Linux Kernel key management