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:
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?


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. |
How do I achieve that?