It is possible, often convenient, and sometimes safe to set up a Linux computer so that a user can boot it (i.e., start it up) and have it proceed directly to a graphical user interface (GUI) without any need for manually logging in.
A GUI is a human-computer interface (i.e., a way for humans to interact with computers) that uses windows, icons and menus and which can be manipulated by a mouse. GUIs stand in sharp contrast to command line interfaces (CLIs), which use only text and are accessed solely by a keyboard.
Logging in, logging on or a login is the entering of identifier information into a system by a user in order to access that system (e.g., a computer or a website). It is an integral part, but only a part, of computer security procedures. A login generally requires the user to enter two pieces of information, first a user name and then a password. This information is entered into a login window on a GUI or on the command line in a console (i.e., all-text mode), depending on the system and situation.
Eliminating the need for logging in can be very convenient because it eliminates the need for some keystrokes and saves time, particularly for computers which are frequently turned on and off.
There is, of course, a security risk to skipping the login, and it is not good training for future system administrators. However, the risk for single-user systems in relatively secure environments, such as a private home, is fairly low and could well be worth taking for the added convenience.
It should also be kept in mind that there are relatively simple ways for intruders to access computers even if logins are required. Also, there are other techniques that can be used to secure computers that have been set up to bypass manual logins.
Automatic Login With the GNOME Desktop
GNOME is one of the two main desktop environments on Unix-like operating systems and the default for Red Hat, Fedora and various other Linux distributions (i.e., versions). A desktop environment is a relatively new type of software that has a goal of developing an integrated, consistent GUI on which all applications have the same look and feel (including similar menus to the extent possible) and interact seamlessly with each other.
On a Red Hat system, for example, the first step to enabling automatic logging into the GNOME desktop is to click the Red Hat icon (which usually appears in the lower left corner of the screen) to open the Main Menu. Moving the mouse cursor (usually an arrow) over System Settings in the menu causes a sub-menu to appear to its right.
Clicking on the Login Screen item that appears in approximately the center of this sub-menu causes a small dialog box (i.e., message box) labeled Query to appear on the screen. This dialog box contains text similar to the following:
You are attempting to run "gdmsetup" which requires administrative privileges, but more information is needed in order to do so.Typing in the root (i.e., administrative) password in the space provided and clicking the OK button causes the GDM Setup panel to open. This panel has five panes, the first of which is labeled General and should open by default.
To enable automatic login for a user, check the small box in the center of the General pane that says Automatic login. Just below that select the user name to which the automatic login applies.
This configuration window changes settings for the gdm daemon, which controls the graphical login screen for GNOME. A daemon is a program that is designed to run continuously in the background and be available when needed. Changes made to gdm will take effect immediately.
The step with the dialog box requesting the root password is bypassed if the user has initially logged in as the root user. However, logging in as the root user is not wise from a security point of view. It is far safer to log in as an ordinary user and then use the su (i.e., substitute user) command to obtain root privileges when necessary.
Automatic Login With the KDE Desktop
The procedure is slightly different for the KDE desktop, the other main Linux desktop environment and the default for SuSE and Mandrake. (Both the GNOME and KDE desktop environments are available for most major distributions and switching between them is easy.)
The first step to graphically enable automatic logon on KDE is to click on the Red Hat icon and then click on the Control Center menu item that appears. This should be followed by clicking on the little plus sign to the left of where it says System Administrator and then clicking on the Login Manager item.
The Login Manager window appears to the right. Root permission, which is necessary in order to make changes, can be obtained by clicking on the Administrator Mode button at the bottom of the window and then entering the root password in the space provided. The next step is to select the Convenience tab near the top of the window, followed by checking the box that says Enable auto-login and selecting the name of the user for which the automatic login will occur. The procedure is completed by clicking the Apply button and closing the window.
Setting Up Automatic Login From The Command Line
Automated login can also be set up through the use of the command line, and for some users this will be more convenient.
For example, the Query dialog box that requests the root password can also be launched by an ordinary user (i.e., a non-root user) from a terminal window (i.e., an all-text mode window in a GUI):
This dialog box can be skipped and the GDM Setup utility can be launched directly if the current user is root or uses the su command to obtain root privileges.
An alternative approach for an experienced (or adventurous) user is to directly edit the GUI login configuration files using a text editor, such as vi or gedit. The locations of these files might vary according to the particular operating system. On Red Hat 9, for example, the gdm daemon configuration file is /etc/X11/gdm/gdm.conf and the kde configuration file is /usr/share/config/kdm/kdmrc.
As is the case with any configuration file, it is wise, even for experienced users, to first make a backup copy of these files before attempting to edit them. This can easily be accomplished by using the cp (copy) command such as the following:
It should be kept in mind that the above explanations are intended to serve only as general guides as to how automatic login can be set up. There will likely be differences according to the distribution and version of Linux. It is also possible that automatic login might be more difficult to set up in some cases; for example, there have been reports of it not functioning without some reprogramming with the KDE desktop on one version of Red Hat Linux.
Created April 12, 2005.