Need to auto-login after logout on ubuntu
Solution 1
Solution provided by Marc Balmer causes restart dead locks on my system driven by systemd. So I've ended up with following setting at /etc/lightdm/lightdm.conf
:
session-cleanup-script=pkill -P1 -fx /usr/sbin/lightdm
The lightdm
handles SIGTERM sent by pkill
and gracefully shut downs and systemd
makes service restarted.
Solution 2
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 videos on Youtube
OmniCorp
Updated on September 18, 2022Comments
-
OmniCorp over 1 year
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.
-
Petr over 3 yearsNote that the author of nodm writes in the README: I do not use nodm anymore. I do not maintain nodm anymore. To be really functional, nodm needs to be refactored to properly be a display manager with all that it requires in 2019 to be one. It currently does not make any effort to do so, and will break in obscure way as a result. Nobody should really need nodm anymore: lightdm's autologin now does the right thing out of the box: please use that.
-
bart almost 3 yearsThere's no reason to downvote this answer as the solution actually works. But you should put that line in a custom config file under the directory lightdm.conf.d/ instead of in the main config file. One line (under the heading
[Seat:*]
in the current version of lightdm). That's all it takes. No need for a separate script