Daily Archive for November 30th, 2009

How to unlock gnome keyring automatically

NetworkManager is a great tool I have used to the wireless networks. It uses gnome keyring to securely store the passwords to your network connections. But the thing that bugged me the most was that on every reboot it popped up a window to put a password to unlock the default gnome keyring. I just hated to put in the password to unlock the keyring after putting the password to login to my account.

There were some guides which told how to get around the problem, but none of them worked for me. Except this one. But I did not like this approach as it involved storing your password in clear text and I’m not a fan of doing so.

So after some hit and trial I figured out that the solution wasn’t that complex , it was just that the guides I was following were outdated or they missed a seemingly unimportant but crucial step. So I am putting together the steps I followed for this just in case I forget. (These steps are Fedora specific)

This works only if your keyring password is same as your login password. If you have already set your default keyring password you may reset it by deleting the keyrings directory which would prompt you to enter a new password for keyring :

rm -rf  ~/.gnome2/keyrings

First of all install the pam_gnome_keyring package :

sudo yum install -y pam_gnome_keyring

Then edit the login manager file :

for GDM

sudo vi /etc/pam.d/gdm

for KDM

sudo vi /etc/pam.d/kdm

Add the following lines

auth       optional    pam_gnome_keyring.so try_first_pass
session    optional    pam_gnome_keyring.so auto_start

The order in which these lines are inserted is important. So here is a working copy of the file:

#%PAM-1.0
auth     [success=done ignore=ignore default=bad] pam_selinux_permit.so
auth       required    pam_env.so
auth       substack    system-auth
auth       optional    pam_gnome_keyring.so try_first_pass
account    required    pam_nologin.so
account    include     system-auth
password   include     system-auth
session    required    pam_selinux.so close
session    required    pam_loginuid.so
session    optional    pam_console.so
session    required    pam_selinux.so open
session    optional    pam_keyinit.so force revoke
session    required    pam_namespace.so
session    optional    pam_gnome_keyring.so auto_start
session    include     system-auth

Save the file and reboot.