Wednesday, September 21, 2011

Setting LightDM to Auto-Login, Ubuntu Oneiric

Ubuntu Oneiric comes with a new display/login manager - LightDM. Most of us are already familiar with 'gdmsetup', which was used to tweak the 'Login Screen' settings in previous versions of Ubuntu, e.g. for choosing the default session, setting your account to auto-login, etc., but Oneiric doesn't come with 'gdmsetup' as it doesn't come with GDM by default.


Setting LightDM to auto-login is even easier, but one doesn't yet have the option to choose the default session. Instead, the currently logged in session would be locked for the auto-login feature when you enable those. Here is how to do it:

Update 2/19/2012: By now, LightDM takes into account the last chosen session, and, thus, overrides any other settings for both 'user-session' and 'autologin-session', set up in the '/etc/lightdm/lightdm.conf'; just make sure your system is updated!

GUI Method

1. Click at your name in the top right corner of your screen and choose 'User Accounts':


2. Press the 'Unlock' button near the top right corner of the 'User Accounts' window and unlock it by entering your password:


3. Choose 'On' right beneath 'Automatic Login' as shown in the screenshot below:


Configuration File Method

LightDM can also be set to auto-login by creating a custom file named 'lightdm.conf' under '/etc/lightdm' directory. This way you can also define your preferred auto-login session.

So, get to a Terminal and run:

gksudo gedit /etc/lightdm/lightdm.conf

If you are doing it from the console, you would need to use 'nano' instead of 'gedit' and 'sudo' instead o 'gksudo'.

In the file that opens up, enter this text:

[SeatDefaults]
autologin-user=<USERNAME>
autologin-user-timeout=0
user-session=ubuntu
greeter-session=unity-greeter

Replace '<USERNAME>' with your username and 'ubuntu' with your preferred session if you want to automatically log in to some other session than regular Unity. These are the most common session options:
  • 'Ubuntu' (regular Unity) :
  • 'Ubuntu 2D' (Unity 2D) :
  • 'GNOME' (Gnome Shell) :
  • 'GNOME Classic' :
  • 'GNOME Classic (No effects)' :
  • 'ubuntu'
  • 'ubuntu-2d'
  • 'gnome-shell'
  • 'gnome-classic'
  • 'gnome-fallback'

Timed Auto-Login and More Advanced Options

To set a timeout for auto-login, change the value of the key 'autologin-user-timeout' located in the '[SeatDefaults]' section of your '/etc/lightdm/lightdm.conf' as indicated in the above section; if the key isn't already there, just add it. - Though there is currently a bug with that!

Here is a complete list of options you can use for tweaking LightDM - as of version 1.2.1:

#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# xsessions-directory = Directory to find X sessions
# xgreeters-directory = Directory to find X greeters
#
[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
#xsessions-directory=/usr/share/xsessions
#xgreeters-directory=/usr/share/xgreeters

#
# Seat defaults
#
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xserver-layout = Layout to pass to X server
# xserver-config = Config file to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# user-session = Session to load for users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# exit-on-failure = True if the daemon should exit if this seat fails
#
[SeatDefaults]
#xserver-command=X
#xserver-layout=
#xserver-config=
#xserver-allow-tcp=false
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
#greeter-session=example-gtk-gnome
#greeter-hide-users=false
#greeter-allow-guest=true
#greeter-show-manual-login=false
#user-session=default
#allow-guest=true
#guest-session=UNIMPLEMENTED
#session-wrapper=lightdm-session
#display-setup-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
#autologin-user=
#autologin-user-timeout=0
#autologin-session=UNIMPLEMENTED
#exit-on-failure=false

#
# Seat configuration
#
# Each seat must start with "Seat:".
# Uses settings from [SeatDefaults], any of these can be overriden by setting them in this section.
#
#[Seat:0]

#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn. Alternatively
# it can be a word and the first 7 characters are used as the key.
#
[XDMCPServer]
#enabled=false
#port=177
#key=

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# port = TCP/IP port to listen for connections on
#
[VNCServer]
#enabled=false
#port=5900
#width=1024
#height=768
#depth=8

Source: "/usr/share/doc/lightdm/lightdm.conf.gz/lightdm.conf"

Related Posts:

LightDM