Sunday, July 19, 2009

How to setup auto-login in Ubuntu at the console.

If you want to setup auto-login in Ubuntu, but for whatever reason you don't have access to the full gnome desktop, such as if you are trying to configure the machine remotely, then these instructions will work for you.
First we'll backup the configuration file and then in your editor of choice, probably vi open up /etc/gdm/gdm.conf.
sudo cp /etc/gdm/gdm.conf /etc/gdm/gdm.conf.bak
sudo vi /etc/gdm/gdm.conf
Next find the line that reads:
AutomaticLoginEnable=false
AutomaticLogin=
In the first line change "false" to "true" and in the second line append the username you want to auto-login after the equals sign. Here is how mine looked:
AutomaticLoginEnable=true
AutomaticLogin=david
After a reboot you will find that Ubuntu goes straight to the desktop of the user you defined.
There are other settings you can set in here, such as a time login. Most of these are available from the GUI, but feel free to look around and find any other settings you might want to change.

Update:  Ubuntu 11.10 Oneric and onwards use LightDM in place of GDM.  Instructions for version of Ubuntu running LightDM can be found here.