How to auto-login in Xubuntu or Ubuntu Server with XFCE?

105,356

Solution 1

Type in a terminal (e.g. Xubuntu, Ubuntu Server with XCFE (e.g. Raspberry PI 3):
sudo -e /etc/lightdm/lightdm.conf

(Better than sudo nano /etc/lightdm/lightdm.conf or sudo mousepad /etc/lightdm/lightdm.conf, see below the reasoning* - Thank you red_trumpet for the hint)

Add these lines to the file:

[Seat:*]
autologin-session=xubuntu
autologin-user=YourDesiredAutoLoginUserName
autologin-user-timeout=0

You could use e.g. file /etc/lightdm/lightdm.conf.d/autologin-xubuntu.conf, instead, but then you should make sure settings in another file in that directory or in file /etc/lightdm/lightdm.conf do not override it.

For GDM-Users

The config file is located /etc/gdm3/custom.conf (according to the other answer, please vote Arbuntu's answer up if you found it helpful):

sudo -e /etc/gdm3/custom.conf

Uncomment the following lines (delete the #) and fill in your user name:

# Enabling automatic login
  AutomaticLoginEnable = true
  AutomaticLogin = YourDesiredAutoLoginUserName

Extra:

To remove password on resume, right-click the system tray power icon then Preferences. This brings up the XFCE power manager (Alternatively you can navigate to XFCE/Settings/Settings Manager/Power Manager). Click Extended in the left pane. Uncheck Lock screen when going for suspend/hibernate.

The last place is XFCE/System/Users and Groups. If it's set "Password: Asked on login" you can change it, and thereafter, if you logout or switch user, you can get back without entering password.

*Reason for using sudo -e instead of the editor directly:
sudo -e copies the file with user privileges, and opens it with your preferred editor. After saving, the file gets copied back to the original file. In this way, the editor does not obtain root privileges, which is a security improvement. (And if configured correctly, your preferred editor is chosen automatically, which is quite convenient).

Sources: lightdm/Read.me, Ubuntu Forum, SuperUser

Solution 2

Click on Settings --> Users and Groups

enter image description here

Next to Password, click on Change

enter image description here

Click on Don't ask for password on login

enter image description here

Solution 3

Things appear to have changed a bit since the accepted answer was written. Under Xubuntu 16.04 the settings have moved to

/etc/lightdm/lightdm.conf

and they look like this

[Seat:*]
autologin-guest=false
autologin-user=gord
autologin-user-timeout=0

Solution 4

In Ubuntu 20.04 with Xubuntu Minimal Desktop

Open a terminal and paste this, it is the same route that you have put @phil294 in an answer above

sudo nano /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf

We will find these lines

[Seat:*]
user-session=xubuntu

You just have to paste this autologin with your username (in lowercase)

autologin-user=username

It will look like this

[Seat:*]
user-session=xubuntu
autologin-user=username

To save in the nano editor

Ctrl + o ==> Enter

To exit the editor

Ctrl + x

The next time you log in, the LightDM window will no longer appear

Solution 5

After following @Filbuntu's answer, I had to do two more things to make this work.

First, I thought the autologin-session parameter was just an alias name so I just put xubuntu, but turns out it should be a valid xsession name. You can see the ones available as files inside /usr/share/xsessions. The session name should be the filename without the .desktop part. In my case I had the following files inside /usr/share/xsessions:

~$ ls -1 /usr/share/xsessions/
ubuntu.desktop
xfce.desktop

My lightdm.conf file ended up like this:

[Seat:*]
autologin-session=xfce
autologin-user=foobar
autologin-user-timeout=0

The second thing, I am not sure if it is required or not, but I looked in LightDM's logs (journalctl -u lightdm) and saw the following line:

pam_succeed_if(lightdm:auth): requirement "user ingroup nopasswdlogin" not met by user "foo"

So to fix it I added my user to this group:

usermod -aG nopasswdlogin foo

Now autologin works as expected.

Share:
105,356

Related videos on Youtube

Filbuntu
Author by

Filbuntu

The space would not be enough :-) ...

Updated on September 18, 2022

Comments

  • Filbuntu
    Filbuntu over 1 year

    In spite of setting auto-login in the Xubuntu settings (XFCE/System/Users and Groups) I have to login each time when I start up the computer. How can this be changed?

  • Filbuntu
    Filbuntu over 9 years
    Thanks a lot for the detailed instructions. Somehow this does not work for me. I checked/unchecked and restarted the system several times, but the login screen would still appear. The solution with editing the 10-xubuntu.conf file worked, though.
  • mTorres
    mTorres over 8 years
    Mitch's answer down here was what I've tried, but it didn't work. This trick did, thanks!
  • Enigma
    Enigma almost 8 years
    This only removes the need to type a password - it does not enable automatic login.
  • phil294
    phil294 about 7 years
    this configuration can be found @ /usr/share/lightdm/lightdm.conf.d/60-xubuntu.conf today.
  • hanshenrik
    hanshenrik over 5 years
    on xubuntu-installed-lightdm on 18.04, the file /etc/lightdm/lightdm.conf does not exist, but if you just copypaste the code to /etc/lightdm/lightdm.conf.d/autologin.conf (or call it whatever you want .conf), that worked for me :)
  • edwardmlyte
    edwardmlyte over 5 years
    Or just create the file /etc/lightdm/lightdm.conf
  • jarno
    jarno over 4 years
    @Blauhirn that is the system provided configuration; system administrators must not modify that.
  • jarno
    jarno over 4 years
    @Blauhirn see the README
  • qwertz
    qwertz over 3 years
    Better use sudo -e /etc/lightdm/lightdm.conf instead of sudo $EDITOR.
  • qwertz
    qwertz over 3 years
    @Filbuntu AFAIU, sudo -e copies the file with user privileges, and opens it with your preferred editor. After saving, the file gets copied back to the original file. In this way, the editor does not obtain root privileges, which is a security improvement. (And if configured correctly, your preferred editor is chosen automatically, which is quite convenient).
  • bcag2
    bcag2 over 3 years
    work for me on a Raspberry PI 3 with Ubuntu server 20.04 and XFCE, thanks.
  • Pamphile
    Pamphile over 2 years
    Most detailed answer here. Thanks for explaining how to list the values accepted by "autologin-session".
  • Adrian
    Adrian about 2 years
    working on XUbuntu 21.10