Skip to content

Instantly share code, notes, and snippets.

@Majlo34
Last active April 10, 2024 17:32
Show Gist options
  • Save Majlo34/cbf059003ae91e1e49e9b00db7342628 to your computer and use it in GitHub Desktop.
Save Majlo34/cbf059003ae91e1e49e9b00db7342628 to your computer and use it in GitHub Desktop.
Unlock gnome-keyring with LUKS password in Ubuntu 24.04

This is useful for folks like me who use auto-login in gnome and don't want unlock gnome-keyring every time during login.

Prerequisites

  • LUKS password and gnome-keyring passwords are same.
  • Ubuntu 24.04 (Could work in other versions, but I did not test it)

FYI : It will store first password you type. If you make mistake and type password 2nd time it wont work.

  1. Install required packages ( package keyutils contain command keyctl)
sudo apt install keyutils
  1. Edit /etc/crypttab, adding the option keyscript=decrypt_keyctl :
sudo vi /etc/crypttab

Example -->

dm_crypt-0 UUID=a19571ac-b032-4073-9ad9-a0a72189ca1b none luks,keyscript=decrypt_keyctl

  1. Edit /etc/pam.d/common-password, adding the option use_authtok to the GNOME keyring line

Example -->

password optional pam_gnome_keyring.so use_authtok

  1. Rebuild initramfs and reboot :
sudo update-initramfs -k all -c
sudo reboot now

After reboot

journalctl -b0 |grep gkr

Apr 10 18:18:03 dell-laptop gdm-autologin][1432]: gkr-pam: stashed password to try later in open session Apr 10 18:18:04 dell-laptop gdm-autologin][1432]: gkr-pam: unlocked login keyring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment