glennji.com

Because breaking things is much more fun

Password-less logins with PAM

May 12

Sometimes you want certain to be able to log in to certain user accounts without a password -- for a guest account, for example. It's not terribly secure, sure, but sometimes you don't need that security. Read on for how to do this on any GNU/Linux OS that uses PAM and GDM.

To enable password-less logins for any operating system that uses PAM and GDM, edit /etc/pam.d/gdm to add the following line:

   auth    sufficient      pam_listfile.so sense=allow file=/etc/passwordless item=user
   
   @include common-auth
   ... 

Then create the /etc/passwordless file (readable only by root). List each user you want to login without a password, one per line.

If you are using the GDM autologin feature, add the line "@include common-pamkeyring" to /etc/pam.d/gdm-autologin. I haven't tried it, but this is reported to allow the no-password user wireless access without entering the keyring password.

If not, you need a script like the following to your session startup:

   #!/bin/sh
   exec echo -n "MyKeyringPassword" | /usr/lib/libpam-keyring/pam-keyring-tool -u -s

However, pam-keyring-tool is not included in Ubuntu 7.10, so you need to compile it.