How to make Lubuntu login automatically?

I want to know how to make Lubuntu 14.04 restart every two hours, login, and open a program. I am currently stuck on the first part which is to make it login automatically. I have tried changing lightdm.conf and lightdm.conf.d folder, and default.conf to no avail. What should I do?


According to the Lubuntu documentation, https://help.ubuntu.com/community/Lubuntu/Boot_Install_Login#For_release_12.04_and_on_.28LightDM.29, You will need to create an /etc/lightdm/lightdm.conf with these contents: (do this as root)

[SeatDefaults]
autologin-user=<YOUR USER>
autologin-user-timeout=0
# Check https://bugs.launchpad.net/lightdm/+bug/854261 before setting a timeout
user-session=Lubuntu
greeter-session=lightdm-gtk-greeter

This solution worked for me. The link (at the bottom) is dead but I got a cached version.

$ sudo nano /etc/lightdm/lightdm.conf

Add the following lines replacing myusername with your user:

[Seat:*]
pam-service=lightdm
pam-autologin-service=lightdm-autologin
autologin-user=myusername
autologin-user-timeout=0

To check use:

$ /usr/sbin/lightdm --show-config

Source: http://www.neatlittleinsights.com/htdocs/lubuntu_16.04_autologin.html