How to tweak autologin in Ubuntu and Linux Mint

Updated: October 24, 2012

Say you have more than one user configured on your Linux box, in the same distribution. You want to toggle between them now and then, and have one of of them auto-login into their desktop session. Not a problem, except that you found out that managing users through the User panel in either Ubuntu or Mint options is rather clunky.

So how do you go about enabling and disabling auto-login and timed auto-login for your users, changing the default choice and managing multiple users in general, without resorting to a somewhat restricted GUI wizard currently available? Well, this is what this article is all about. Please follow and I will show you. Rather quite simple, but still rather quite necessary.

User management

You will probably want to create new users through the Users panel. Please note that new users will be disabled by default. And even when you activate them, they will not have auto-login configured. Nor can there be more than one user with auto-login.

Users setup

Manage automatic login

Now, let's say you want to configure your user to have the automatic login on/off. You can toggle the switch in the GUI, and that should work. But not always, and sometimes, with multiple users, you will find the editing to be rather cumbersome, as you need to unlock the panel, figure out the conflicts and suchlike.

It is easier to manage the login using command line and editing the relevant configuration files directly. This is a little trickier from the skillset perspective, but if you are confident enough and willing to make a backup first before making any drastic changes, the exercise is worth its geeky investment.

Edit configuration files

Let's review the configuration files for Ubuntu family and friends:

in Ubuntu 11.04 and lower, the configuration is stored in /etc/gdm/gdm.conf.

In Ubuntu 11.10 and higher, the file is /etc/lightdm/lightdm.conf.

In Mint, the relevant file is /etc/mdm/mdm.conf.

Now that we know what we need, editing becomes simple. As sudo, with necessary backup beforehand, of course. But you knew that already.

What you want to look is the following set of directives. In Ubuntu:

autologin-user=<name> - Name of the user

autologin-user-timeout=<value> - Timeout before session is loaded

Auto-login config in Ubuntu

In Mint, the following directives:

AutomaticLoginEnable - Do you want the autologin on or off

AutomaticLogin=<user> - The name of the lucky user

TimedLoginEnable - Do you want to enable auto-login on session restart

TimedLogin=<user> - Name of the user for timed logins

TimedLoginDelay - Delay before entering the session again

Auto-login config in Mint

And that's all really. Honest.


This is a very short tutorial. But it is useful. If you wondered and fretted about what governs your login sessions, the answer is - it is you. You have the tools required to make changes quickly and easily and avoid getting lost in the GUI. While I normally avoid suggesting command line as the first resort for problems, here, it's the best option.

Now that you know what you can do with session managers, it's just the matter of choosing the right user and setting the comfortable delay. After that, you will have the session control you want and need. And if you regret something, reverting or fixing the problem is quite easy. Well, I guess that would be all for now.


You may also like: