How to put Lubuntu into automatic login mode

Some Unix/Linux systems require that a username and password be entered for login. Some can be set up to log you in automatically. For Lubuntu -- a lightweight version of the popular Ubuntu distribution, you can move between these two login options with a mere flick of your wrist and a wee bit of editing.

When I first installed Lubuntu on a tiny, under $300 Acer laptop, the installation script asked whether the system should be set up for multiple logins. Thinking this was what the end user would want, I said yes. Later on, I realized an automatic boot into the configured account was going to work out better. So, the task at hand was to reverse my decision. Instead of redoing the install, however, I decided to look into how this option was reflected in the system's configuration file and make the changes there. It didn't take long to figure this out and make the change.

Automatic login is the process of booting into a known user account without prompting the user to identify himself. Press the power button, the system boots, the desktop appears, and the configured account is ready for use. It's a nice choice for a system that will only be accessed by one individual and where controlled access is not an issue.

Automatic login should not to be confused with single user mode (run level 1), so I try to steer away from any use of the phrase "single user" in talking about automatic login. The two issues are entirely unrelated.

When you set up a system for automatic login, the configured user will be a member of the adm (administrative) group and will be configured during the installation with sudo rights. Basically, anything root can do, the configured user can do as well through the sudo command. If the user wants to be root on more than a command-by-command basis, he or she can issue the "sudo su" or "gksudo su" command and then assume root's identity for a period of time.

In fact, when you set up a Lubuntu system for multiple logins, the account that you create on installation will also be set up this way -- with full access to root granted through the facilities of the sudoers file, which is automatically configured to give the user permission to run any command with root authority.

Where you make the changes to configure a Lubuntu system for automatic login depends on the release you are using. In releases prior to 12.04, the change must be made in the file /etc/lxdm/default.conf. You can open a terminal (lxterminal) and edit it with vi (e.g., gksudo vi /etc/lxdm/default.conf) or use a desktop editor like leafpad (e.g., gksudo leafpad /etc/lxdm/default.conf).

Uncomment the following line and change "dgod" to the intended login name. This ensures that the automatic login recognizes your account and knows where your home directory and files belong, etc.

# autologin=dgod

After the change, the autologin line in your file might look like this:


This process was covered in an article earlier this year. Check out: Turn on auto-login in Ubuntu.

In Ubuntu releases starting with 12.04, however, you need to edit a different file. With the new display manager, lightdm, a different file is used to manage this setting. So, you edit the /etc/lightdm/lightdm.conf file instead.

lightdm is an X display manager that is fast, extensible and provides the ability to use multiple desktops -- like lubuntu and OpenBox. The lightdm.conf file, after your changes, will look something like this. Note the lack of # signs on the autologin lines:


You can switch back to the using a username and password to log in in by reversing the changes described above. Put the comment markers back in front of the autologin lines and reboot.

In both cases, the username must match the one you set up when you installed the system or you will need to edit your /etc/passwd and /etc/shadow files and move the home directory to match the new name.

Obviously, autologin can only be used for one account. The system needs to know which account to activate when it boots.

Anyone who picks up your automatic login system "owns" the system, so don't use this kind of setup for any system that contains information that will be at risk if someone other than the intended user gets their hands on it.

This article is published as part of the IDG Contributor Network. Want to Join?

Now Read This: IT Resume Makeover: Our top 11 tips
View Comments
You Might Like
Join the discussion
Be the first to comment on this article. Our Commenting Policies