#!/bin/sh

# Add a user that has no password from a GDM login screen
# (And from the gnome screen saver, in case you forgot to disable it)
# Makes it simpler for you to lend the computer to your young nephew.

USER="play"
LISTFILE="/etc/security/gdmonly_nopass"
LINE_ADDED="auth sufficient pam_listfile.so item=user sense=allow file=$LISTFILE onerr=fail"

# Adds the user itself:
adduser --gecos --disabled-password "games user" $USER

# set the list of users allowed to login without a password in gdm
echo $USER >$LISTFILE

# The PAM magic to make this work:
# KDE users:  kdm kscreensaver
for service in gdm gnome-screensaver
do
	sed -i -e "/@include common-auth/i$LINE_ADDED" /etc/pam.d/$service
done
