Article 57KHB How to use Linux keyring to create a session-less key that is accessible from cron and services and lives forever until the next reboot?

How to use Linux keyring to create a session-less key that is accessible from cron and services and lives forever until the next reboot?

by
midiox
from LinuxQuestions.org on (#57KHB)
I would like to create a keyring key that can be used from session-less processes (cron, daemons etc.).

Keyctl documentation suggests:

Quote:
keyctl_get_persistent() gets the persistent keyring for the specified user ID. Unlike the session and user keyrings, this keyring will persist once all login sessions have been deleted and can thus be used to carry authentication tokens for processes that run without user interaction, such as programs started by cron.
However, keyctl_get_persistent expires after /proc/sys/kernel/keys/persistent_keyring_expiry time, which is three days by default. That is not good for me. I'd like to have the key valid, hypothetically, forever, until a reboot.

How do I achieve that?latest?d=yIl2AUoC8zA latest?i=8VWaWDwvUqY:Pn2zCLrJKOg:F7zBnMy latest?i=8VWaWDwvUqY:Pn2zCLrJKOg:V_sGLiP latest?d=qj6IDK7rITs latest?i=8VWaWDwvUqY:Pn2zCLrJKOg:gIN9vFw8VWaWDwvUqY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments