Configuring KDM and GDM

The First Display

Hagen Höpfner

Both KDE and GNOME have display managers. We'll look at the features offered by KDM and GDM, and we'll examine how to configure a display manager for your Linux system. <@65_VA>By Hagen Höpfner

On many systems, the display or login manager is the first GUI program the user sees. Most major distributions automatically launch the X Window system. Users type their names and passwords to log on and select an environment. They can often select other options, such as an option for shutting down or rebooting.

KDM, by the KDE project, and its Gnome counterpart GDM are the most popular display managers, but there are a number of alternatives, such as the legacy XDM or the small-footprint WDM managers. The login manager has no influence on the desktop the machine runs; even the biggest KDE fans could still use GDM to log on to the system and launch their favorite environment. The only disadvantage is that installing GDM puts a lot of Gnome libraries on your hard disk, taking up valuable storage space. This article explains how to change the display manager on Fedora Core 2, Suse Linux 9.1, and Mandrake Linux 10.0, and how you can add window managers to the drop-down list.

Basics

Most distributions install a display manager when they install Linux. Suse and Mandrake use KDM by default (Figure 1); Fedora uses GDM (Figure 2). If you want to test an alternative display manager, you will first need to add it to your current installation. Whereas GDM is located in the gdm package under Fedora Core 2, Suse, and Mandrake Linux, KDM can be located in various RPM packages. Under Suse, the package is called kdebase3-kdm; Mandrake Linux calls it kdebase-kdm; and Fedora users should watch out for kdebase.

Figure 1: The KDM login screen under Suse Linux.

Figure 2: GDM welcomes users to Fedora Core 2.

On Mandrake and Suse Linux, you may not even get to see the display manager if you select automatic login when you install the system. This may be acceptable for single-user machines, where that user only needs one desktop, but there are a few drawbacks: for one thing, it is quite difficult to switch to an alternative desktop; for another, anyone can access your data just by switching on the machine.

To disable autologin on Suse Linux, launch YaST and select the etc/sysconfig/ Editor in System. Edit the entry for Desktop | Display manager | DISPLAYMANAGER_AUTOLOGIN, removing the user name from the field on the right side of the window.

Mandrake Linux uses the drakconf configuration tool. Select Autologin in Boot and change the selection to No, I don't want autologin. Make sure you do not disable the Launch the graphical environment when your system starts checkbox by mistake. This setting prevents the GUI from launching when you boot, forcing you to log on to a text-based console first and type startx to access the KDE desktop.

Figure 3: KDM on Mandrake Linux - step by step.

Switching between GDM and KDM

To change the default display manager, you will need to make some manual changes to both Mandrake Linux and Fedora Core 2. Both distributions use the /etc/X11/prefdm file to launch the login program. prefdm reads the login manager setting from an environment variable called DISPLAYMANAGER, and /etc/sysconfig/desktop tells you what this is set to. The line that sets the manager will read either DISPLAYMANAGER="kdm" or DISPLAYMANAGER="gdm". Launching the GUI pops up the selected login manager.

Mandrake offers two KDM variants: a Mandrake specific version that is used by default (Figure 3), and the plain vanilla KDM. If you set the DISPLAYMANAGER variable to kdm, the original KDM is displayed when you launch the GUI. The Mandrake version of the login manager is displayed if you set DISPLAY- MANAGER="KDE" in /etc/sysconfig/desktop.

Suse Linux users need the /etc/sysconfig/Editor in YaST. This tool is a front-end that gives users convenient access to the /etc/sysconfig/ directory. If you prefer a text editor to YaST, just edit the DISPLAYMANAGER variable in /etc/sysconfig/displaymanager for Suse Linux.

Figure 4: Suse Linux gives users the full range of KDM options at a glance.

Figure 5: Modifying the look & feel of KDM.

In Control of KDM

Every distribution has default settings that define what KDM looks like. Under Suse, KDM prompts users to enter their Username and Password and also has a Menu (Figure 4) that allows users to select the Session type and functions for relaunching the X server and shutting down the system (Shutdown).

Mandrake Linux expects users to first select a username, and then it displays a password dialog box (Figure 3) where users can specify the desktop they want to launch. Fedoras KDM is quite plain in comparison but behaves exactly like the KDM on Suse Linux.

All three variants allow users to log on, but there is at least one good reason to change the default. The session type selection is based on preinstalled window managers and desktop environments. If you install an additional window manager, the login manager will not display an entry for the new window manager unless the distributor happens to have a session script to match. Both KDM and GDM ignore window managers without a matching script. The qlwm manager is one example.

To tell KDM to add a qlwm entry, you need to create a new session type. KDE used to have a Control Center entry to handle this, but KDE 3.2 no longer has. Instead you need to log on as root and create a session script for the new entry. A session script is a text file that contains parameters for the window manager. Suse Linux stores session scripts below /opt/kde3/share/apps/kdm/sessions/; Mandrake Linux and Fedora Core 2 expect these entries below /usr/share/apps/kdm/sessions/. Type the file name - qlwm.desktop in our example (you can choose any name, but the extension is mandatory) - and then add the following entries:

[Desktop Entry]
Encoding=UTF-8
Type=XSession
Exec=/usr/local/bin/qlwm
TryExec=/usr/local/bin/qlwm
Name=QLWM

Finished! The next time you log in, KDM will have a QLWM session type entry. The session type name is defined in the Name= line; QLWM in our case. This assumes there is a file called /usr/local/bin/qlwm and that the file is executable (TryExec). Now, if you select QLWM as the session type when you log in, KDM should run the program specified in the line starting with Exec. KDM sorts the session type in the drop-down menu alphabetically by session script name. If you wanted to make QLWM the the first entry in the list, you could rename the script you created in the previous step to 00qlwm.desktop from qlwm.desktop.

Figure 6: GDM configuration dialog.

Good Looking

If you are unhappy with the way KDM looks and feels, check out the KDM configuration tool. The tool is located in the KDE Control Center below System administration | Login manager (Figure 5). Besides tabs for fine tuning the appearance of the login manager (Appearance, Font, Background), there are three tabs for general options. The Shutdown tab allows you to specify users who are allowed to shut down and restart the machine. The Users tab allows you to define the selection of user accounts that KDM displays.

See the KDM manual [1] for more on configuring KDM, Unfortunately, the manual is not up to date in all respects, although it is supposed to cover KDE 3.3.

Log on à la Gnome

Just as with KDM, the appearance of GDM is distribution-specific. Suse Linux has a Language feature for setting the language for the login procedure. Session gives users a list of selectable window managers and desktop environments, and System has options for shutting down and restarting the computer, along with an entry for configuring XDMCP. And there is also an entry that launches the GDM configuration program. GDM on Mandrake Linux looks exactly the same with the exception of the System menu item, which is called Actions.

Fedora, which uses GDM by default, does not have a menu with options for shutting down and restarting. Nor does Fedora have an option for launching the GDM configuration tool. However, the root user can run the gdmsetup command after logging on to access these features (Figure 6).

In the Security tab, you can specify whether you want to allow access to the configuration dialog from the login window. However, if you check Allow configuration from the login screen on Fedora Core 2, you will still not see a gdmsetup button when logging on. The Fedora Core 2 GDM theme is to blame. If you choose a different theme in the Graphical greeter tab, Fedora GDM will be quite happy to show you the configuration tool. As the selection of pre- installed login themes is limited, you might like to surf to [3] to pick a new theme. Again you will need to run gdmsetup to install any themes you download from the Internet.

It is quite simple to tell GDM to display a session type selection for any window managers you install, just as simple as it is with KDM, in fact. The only difference between the two configurations is the path to the session script; GDM on Suse Linux expects to have the script in /opt/gnome/share/xsessions. The path for Mandrake Linux and Fedora Core 2 is /usr/share/xsessions/. If you are looking for more information on configuring GDM, check out the GDM reference manual at [4].

Glossary

Theme: A theme is a collection of elements that give a GUI-based application a predefined appearance. Besides most window managers, applications such as Mozilla or XMMS support themes.

XDMCP: The X Display Manager Control Protocol [2] was developed to allow access to X sessions across networks. Remote users can work as if they had direct access to a machine, from logging on to running GUI-based applications on the X server. For security reasons, and to reduce the network load, SSH is preferable to XDMCP.

Info

[1] KDM manual: http://docs.kde.org/en/HEAD/kdebase/kdm/

[2] Linux XDMCP HOWTO: http://www.tldp.org/HOWTO/XDMCP-HOWTO/

[3] GDM themes: http://art.gnome.org/themes/gdm_greeter/

[4] GDM reference manual: http://www.jirka.org/gdm-documentation/t1.html