Ubuntu – Need to auto-login after logout on ubuntu

autologinkiosklightdmUbuntu

I've set up a kiosk using Ubuntu 12.04, and I'd like to have it autologin after a user logs out or if the screen locks, in case someone manages to get back to lightdm or tries to login to the non-kiosk account after a reboot. I've tried setting display-setup-script in lightdm.conf to run xautolock to trigger restarting lightdm, but that just causes Ubuntu startup in low graphics mode. So basically, if lightdm is active instead of a user being logged in, log in the kiosk user.

Best Answer

create the script below in e.g. /etc/lightdm/restart and make it executable (chmod 755), then enter the path to the script in /etc/lightdm/lighdm.conf as session-cleanup-script value:

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
autologin-user=kiosk
autologin-user-timeout=10
allow-guest=no
session-cleanup-script=/etc/lightdm/restart

and here is the script:

#!/bin/bash

trap "" SIGHUP SIGINT SIGTERM
PATH=$PATH:/sbin:/usr/sbin
service lightdm restart 

This will restart lightdm whenever someone logs out, restarting the auto-login process.

Related Question