101

I want user foo to auto-login using LightDM (which has been used by Ubuntu since version 11.10). How would I do that?

Jorge Castro
  • 73,717
htorque
  • 66,086

14 Answers14

98

An alternative to Alin's answer is to create a file /etc/lightdm/lightdm.conf and add the following content:

[SeatDefaults]
autologin-user=<YOUR USER>
autologin-user-timeout=0
user-session=ubuntu
# Uncomment the following, if running Unity
#greeter-session=unity-greeter

Next time you start, auto-login should work like expected.

htorque
  • 66,086
51

You can do this without editing configuration files: go to System Settings > User accounts, click "Unlock" and enter your password, then click the button next to "Automatic login":

'enter image description here

Jorge Castro
  • 73,717
Alin Andrei
  • 7,358
36

From Ubuntu 14.04 and above create the file:

/etc/lightdm/lightdm.conf.d/12-autologin.conf

and add:

[SeatDefaults]
autologin-user=youruser
nkef
  • 1,151
  • 1
  • 10
  • 15
18

You can easily do this with lightdm-set-defaults if you'd rather not edit lightdm.conf manually:

sudo /usr/lib/lightdm/lightdm-set-defaults --autologin "$USER"

It will not set the autologin timeout, but the default for that is 0 in the code anyway, so you don't need to set it.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
mfisch
  • 3,693
10
gksu gedit /etc/lightdm/lightdm.conf

add lines:

autologin-user=username
autologin-user-timeout=0

example:

[SeatDefaults]

user-session=ubuntu

greeter-session=unity-greeter

autologin-user=alan

autologin-user-timeout=0
Seth
  • 59,332
Alan
  • 101
3

Open settings, select 'user accounts'. Click the unlock button, then change the Automatic Login switch to "On"

luyangl
  • 31
2

In Ubuntu 18.04 (Xubuntu Minimal Desktop), create /etc/lightdm/lightdm.conf and add the following:

# /etc/lightdm/lightdm.conf
[SeatDefaults]
autologin-user=<username>
autologin-user-timeout=0

I couldn't get it working through the lightdm.conf.d folder.

Jaakko
  • 203
1

Ubuntu 20.04 How To: automatic login of particular user (e.g. server login)

autologin for Ubuntu 20.04 and Ubuntu 20.04 LTS with XFCE4 this works:

(all as root using sudo)

0) set display manager to lightdm

dpkg-reconfigure lightdm

check settings with

lightdm --show-config

1) enable login without password

under Users and Groups

set the Not asked login option for the concerned user.

2) create and edit a new file /etc/lightdm/lightdm.conf.d/01_username.conf

vim /etc/lightdm/lightdm.conf.d/01_username.conf

and set

[SeatDefaults]
autologin-user=username
autologin-user-timeout=0

replace "username" according; do NOT set autologin-user-timeout other than 0, does not work!

This solution worked fine with a nearly vanilla installation without gnome and without unity.

opinion_no9
  • 1,072
1

For kali-rolling: (may work for other kali versions)

sudo sed -i '/^\[Seat:\*\]$/a autologin-user=YOUR_USERNAME\nautologin-user-timeout=0' /etc/lightdm/lightdm.conf

then create/add yourself to autologin group

sudo groupadd -r autologin
sudo gpasswd -a username autologin

and reboot.

the command uses a seds insert after regular expression match feature to insert the line needed in the right section, you can alternatively just edit the file and add autologin-user= in the Seat section.

Leathan
  • 135
1

Search for "User Accounts" application. Select the account you want to autologin Toggle the Automatic Login switch to On

That should do the work.

Fernando
  • 348
1

I can confirm that this works for 16.04.
Using your favourite editor, amend /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf.
Add autologin-user=xxxx to the file, for example:

[Seat:*]
greeter-session=lightdm-gtk-greeter
autologin-user=wmurphy

Remember to also set the Not asked to login option under Users and Groups.

Zanna
  • 72,312
0

I have 12.10 xubuntu. In users and groups choose your user, and click word "Change..." next to "Password:" (it does not look like a button, what might be a bit misleading). There you can change password, or at the bottom mark "Don't ask for password on login" box.

Hope it works.

Chris
  • 1
0

I just discovered that, I need to have ubuntu-desktop to be install before lightdm could function. This solved my issue when trying to get lightdm to actually login in without going in loop.

The reason for the system to go in loop may be because lightdm needs the ubuntu desktop before it may work.

sudo apt-get install ubuntu-desktop
Faron
  • 1,418
  • 11
  • 14
0

I had the same problem, I solved it with the following steps:

  1. login as root: sudo su
  2. enter the file:

    sudo nano /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
    
  3. at the bottom add:

    autologin-user=xxxx
    
  4. save the content of the file then exit and reboot.

This should definitely work.

Olorin
  • 3,548