Understanding lightdm.conf

Based on the questions I’ve seen on AskUbuntu, lightdm.conf is one of the most misunderstood files on your system. So, I decided I’d write a post on how you can easily modify this file and what the modification are useful for. I hope to show how to modify the most asked about settings.

Safely Modifying lightdm.conf

Before you do anything to your lightdm.conf file, you should make a backup, simply run:

sudo cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.old

Once you’ve made a backup, the simplest and safest way to modify lightdm.conf is to use lightdm-set-defaults. lightdm-set-defaults was written so that lightdm.conf could be modified via script, but you can also use it to easily make changes. I’ve made several changes to this tool to add new features that I needed, and best of all, I even wrote a manpage for it, which should show up in raring at some point. If you’re not using raring, then just run /usr/lib/lightdm/lightdm-set-defaults with no arguments and you’ll get a clear picture on what it can do.

Usage:
lightdm-set-defaults [OPTION...] - set lightdm default values

Help Options:
-h, --help Show help options

Application Options:
-d, --debug Enable debugging
-k, --keep-old Only update if no default already set
-r, --remove Remove default value if it's the current one
-s, --session Set default session
-g, --greeter Set default greeter
-a, --autologin Set autologin user
-i, --hide-users Set greeter-hide-users to true or false
-m, --show-manual-login Set show-manual-login to true or false
-R, --show-remote-login Set show-remote-login to true or false
-l, --allow-guest Set allow-guest to true or false

You can also edit the file manually, but in either case, manual edit or set-defaults, you’ll need to use sudo. And now that you know how to modify the file, let’s cover what the most frequently asked about items are.

Disabling Guest Login

Some people really get annoyed by guest login, so if you want to disable it, simply use:

sudo /usr/lib/lightdm/lightdm-set-defaults --allow-guest false

Or, you can manually add the following line in the [SeatDefaults] section:

allow-guest=false

The default for this option is true, so if unset, the guest account will be enabled.  Note: See how great the command option for lightdm-set-defaults was named? Whoever added that was a genius.

Hiding the User List

If you don’t want a user list to be displayed by the greeter, you can enable this option. This should also be used with the enabling manual login (below) or logging in may be a challenge (actually I’ve never tried one without the other, I’m not sure what will happen).

sudo /usr/lib/lightdm/lightdm-set-defaults --hide-users true

Or, you can manually add the following line in the [SeatDefaults] section:

greeter-hide-users=true

The default for this option is false, so if unset, you will get a user list in the greeter.

Show Manual Login Box

If you previously hid your user list and would like a box where you can manually type in a user name then this option is for you.

sudo /usr/lib/lightdm/lightdm-set-defaults --show-manual-login true

Or, you can manually add the following line in the [SeatDefaults] section:

greeter-show-manual-login=true

The default for this option is false, so if unset, you won’t get a manual login box.

Autologin

You can enable autologin by specifying the autologin user.

sudo /usr/lib/lightdm/lightdm-set-defaults --autologin username

Or, you can manually add the following line in the [SeatDefaults] section:

autologin-user=username

There are other autologin related options which you may want to set, but none of these can be set using lightdm-set-defaults:

To change how long the greeter will delay before starting autologin.  If not set, the delay is 0, so if you want this to be 0, you don’t need to change it.  Note: the default for all unset integers in the [SeatDefaults] section is 0.

autologin-user-timeout=delay

To enable autologin of the guest account:

autologin-guest=true

Run a Command When X Starts, When The Greeter Starts, When the User Session Starts

When lightdm starts X you can run a command or script, like xset perhaps.

display-setup-script=[script|command]

You can do something similar when the greeter starts:

greeter-setup-script=[script|command]

or when the user session starts:

session-setup-script=[script|command]

Change the Default Session

If you want a different session for the default, you can modify this option. I think that the greeter will default to give you the last session you chose, so this option will only change the default session. Note: The session switcher will only show up if you have more than one VALID session; a valid session is one that points to a valid executable. By default in 12.10 you will have a session file for gnome-shell, but gnome-shell won’t be installed, so the session is invalid, leaving you with a single valid session (Ubuntu), and hence no session selector!

/usr/lib/lightdm/lightdm-set-defaults --session [session name]

Or, you can manually add the following line in the [SeatDefaults] section:

user-session=true

The list of user sessions is in /usr/share/xsessions, although even that location is configurable (see Advanced Options).

You can change the default greeter in the same manner, using –greeter for lightdm-set-defaults or greeter-session for the config file. The list of installed greeters is in /usr/share/xgreeters.

Advanced Options and All Other Options

There is no manpage for lighdm.conf, but there is an example that lists all the options and a bit about what they do, just look in /usr/share/doc/lightdm/lightdm.conf.gz.  If you use vim, you can just edit the file and it will be automagically ungzipped for you, users of other editors are on their own.

Tagged , ,

20 thoughts on “Understanding lightdm.conf

  1. carif says:

    emacs (>= 23) will also unzip the file first before loading it into an editing buffer.

    Nice article, Matt. Thanks.

  2. didrocks says:

    I shamelessly claiming the lightm-set-defaults name :)

    In fact, I implemented it in gdm at the time for Ubuntu Netbook Remix where we needed a different default session and the name was gdm-set-default-session, and then, we started to add more options… Finally, when lighdm came in, I ported it to it without the dbus part which was needed for gdm.

  3. I presume this is valid for Ubuntu 12.10 and up?

  4. Leo Simon says:

    I’ve just spent the better part of two days trying to disable lightdm so that I could boot to console mode. There are several advertised ways to do this, the simplest being to /boot/default/grub so that /proc/cmdline contains the word “text”. lightdm.conf checks /proc/cmdline for this word, and if it finds it, drops you into console mode.

    But on my system, modified by a patch that somebody wrote to fix ubuntu 12.04’s sound problems

    https://help.ubuntu.com/community/SoundTroubleshootingProcedure

    none of this worked. The reason turned out to be that lightdm was in fact being called from within gdm.conf, so that lightdm.conf was being bypassed completely. And gdm.conf was *not* setup to check for “text” in /proc/cmdline.

    This seems like an extremely unfortunate setup, since it rendered lightdm.conf completely irrelevant and all modifications to it ineffective

  5. Rot says:

    Do you know how to bypass the lightdm greeter screen? I mean I want simply power on my laptop and see the desktop. I already set the autologin for my user, but I still have to choose the session. I want to autologin also for default session (the last one). I run Lubuntu 12.04. Thank you

  6. Rot says:

    Yes, of course I have a default choice (Lubuntu), in fact my lightdm.conf file has user-session=Lubuntu set.
    But the point is that I don’t want to press the login button or any other button to access my desktop.
    Thanks

    • Matt Fischer says:

      What greeter does Lubuntu run? That should be in your lightdm.conf file as well. I’m unsure why this wouldn’t work in lightdm. Maybe I can setup a Lubuntu VM later today. Is it 12.10?

  7. Rot says:

    I have in lightdm.conf file greeter-session=lightdm-gtk-greeter.
    I run Lubuntu 12.04.1

    • Matt Fischer says:

      I just installed Lubuntu 12.10 in a VM, dropped to a shell, edited lightdm.con, added autologin-user=ubuntu, rebooted, and… It works fine. So you’ve got something screwed up in your config. I recommend AskUbuntu or possibly a bug.

  8. James says:

    I have a little problem here. When I select my user in the login screen it doesn’t ask for the password although I have set one. I’ve tried enabling the manual login but just typing my username makes it go to the desktop. Thanks anyway!

  9. John Kibbe says:

    Just a gotcha I found with a persistent Lubuntu 13.04 USB key. I don’t like autologins, but when I created a new user account and commented out the “autologin-user=lbuntu” lines in lightdm.conf, and rebooted, I found that the “autologin-user=lbuntu” had been prepended back into the lightdm.conf file! Made me nuts for a while…

    Eventually, I unzipped initrd.lz and found the scriptfile “15autologins” down in casper/scripts/casper-bottom had the conditional test on “grep ^autologin-user”, which fails when the “autologin-user=lbuntu” gets commented out with “#autologin-user=lbuntu”, and then uses sed to insert the lines back in.

    I found that commenting out the “autologin-user=lbuntu” lines and adding a “autologin-user=noone” (a non-existent user) at the end of lighdm.conf to be a “quick and dirty” fix to disable autologins.

    Of course, the “elegant” way would be to edit the scripts from initrd.lz and then rebuild, but I’m kind of lazy sometimes…

  10. JC says:

    I’m using lightdm-gtk-greeter as my greeter. The allow-guest and all autologin-* parameters seem to be being ignored. I can’t disable the guest account, I can’t enable auto loging (yes, user is in “autologin” group). Why are these settings having no effect?

  11. Tim Schutte says:

    Great tips on Lightdm–I have been fighting with it for weeks, you provided the answers I needed to set it up the way I want it.

    Thanks!
    Tim

  12. Chris says:

    Hi Matt

    Just wanted to say ‘hi’ and ‘thank you’.
    After setting up Quest Authentication and joining a Ubuntu 13.10 workstation to a AD domain, your clear instructions on configuring the login screen were just what I needed.

    Best regards
    Chris

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>