# The &kdm; Handbook

&Oswald.Buddenhagen; &Oswald.Buddenhagen.mail;
2000 &Neal.Crook;
2002 2007 &Oswald.Buddenhagen;
2003 &Lauri.Watts;
&FDLNotice;
2007-12-07
0.06.00

This document describes &kdm; the &kde; Display Manager. &kdm; is also known as the Login Manager.

KDE kdm xdm display manager desktop manager login manager

## Introduction

&kdm; provides a graphical interface that allows you to log in to a system. It prompts for login (username) and password, authenticates the user and starts a session. &kdm; is superior to &xdm;, the X Display Manager, in a number of ways.

## Quick Start Guide

This is a quick start guide for users who fit the following pattern:

- X is configured and works with the command `startx` from the commandline.

- Each user will generally only use a single window manager or desktop environment, and does not change this choice very often, or is comfortable editing a single text file in order to change their choice.

This scenario will be sufficient for many environments where a single user or several users normally boot the computer and log into their preferred environment.

Setting up a Default Session

- Create or open the file `~/.xinitrc`

  If you already have a working `~/.xinitrc`, go to the next step

- If one does not already exist, add a line to the `~/.xinitrc` to start your preferred window manager or desktop environment.

  For &kde; you should enter:

      startkde

  For other window managers or desktop environments, you should look in their documentation for the correct command.

- Make a link as follows:

      ln -s ~/.xinitrc ~/.xsession

At this point, typing ``startx`` on the commandline should start X, with a &kde; session. The next task is to try &kdm;.

As root, type ``kdm`` at the prompt.

You should see a login window, which is described more fully in .

Typing your normal username and password in the fields provided, and leaving `default` selected as the session type should now open a &kde; session for your user.

If you have other users to configure, you should repeat the procedure above for each of them.

This is a quick guide to getting up and running only. You probably will want to customize &kdm; further, for example, to hide the names of the system accounts, to allow further sessions, and much more. Please read through the rest of this manual to find out how to do these things.

## The Login Window

The user interface to &kdm; consists of dialog boxes. The main dialog box contains:

- Widgets allowing you to authenticate. When the "classic" authentication method is chosen, these are:

  - A Username: field for you to enter your username.

  - A Password: field for you to enter your password.

- (Optionally) a list containing entries with the name and graphical image of each user (for example, a digitized photograph). Clicking a list entry is equivalent to typing the associated username into the Username: field.

- (Optionally) a region to the right of or above the authentication area which can be used to display either a static image or an analog clock.

- A Login button that validates the username/password combination and attempts to start a session of the selected type.

- A Menu button that opens an action menu with the following items:

  - (Optionally) A Session Type item to choose the type of session (desktop environment, window manager) to start. See to find out how to configure different session types.

  - (Optionally) A Authentication Method item to switch between different authentication methods like the classical username+password, smartcard, biometry, &etc; The actual authenticators are combinations of PAM modules and matching frontend modules (conversation plugins). See .

  - (Optionally on local displays) A Switch User... item to switch between local sessions running on different virtual terminals of this computer.

  - (Optionally on local displays) A Restart X Server item that terminates the currently running &X-Server;, starts a new one and displays the login dialog again. You can use this if the display content seems to be broken somehow.

  - (Optionally on remote displays) A Close Connection item that closes the connection to the &XDMCP; server you are currently connected to. If you got to this server through a host chooser, this will bring you back to the chooser, otherwise it will only reset the &X-Server; and bring up the login dialog again.

  - (Optionally on local displays) A Remote Login item that displays a host chooser dialog with &XDMCP; servers one can log into remotely.

  - (Optionally on local displays) A Console Mode item that terminates graphical login and leaves you at the console. See and .

  - (Optionally) A Shutdown... item that displays the Shutdown dialog box.

The Shutdown dialog box presents a set of buttons that allow one of these actions to be executed:

Turn Off Computer

  Shut the system down in a controlled manner, ready for power-down.

Restart Computer

  Shut the system down and reboot. For systems that use Lilo or Grub, an optional drop down box allows you to select a particular operating system to be used for the reboot.

Schedule...

  If this option is enabled, you may use it to enter a more complex shutdown dialog. See for details.

Pressing the Cancel button returns to the main &kdm; dialog box.

## Configuring &kdm;

This chapter assumes that &kdm; is already up and running on your system, and that you simply want to change its behavior in some way.

When &kdm; starts up, it reads its configuration from the folder `$`KDEDIR`/share/config/kdm/` (this may be `/etc/kde4/kdm/` or something else on your system).

The main configuration file is &kdmrc;; all other files are referenced from there and could be stored under any name anywhere on the system - but usually that would not make much sense for obvious reasons (one particular exception is referencing configuration files of an already installed &xdm; - however when a new &kdm; is installed, it will import settings from those files if it finds an already installed &xdm;).

Since &kdm; must run before any user is logged in, it is not associated with any particular user. Therefore, it is not possible to have user-specific configuration files; all users share the common &kdmrc;. It follows from this that the configuration of &kdm; can only be altered by those users that have write access to `$`KDEDIR`/share/config/kdm/kdmrc` (normally restricted to system administrators logged in as root).

You can view the &kdmrc; file currently in use on your system, and you can configure &kdm; by editing this file. Alternatively, you can use the graphical configuration tool provided by the &systemsettings; (the Login Screen module in the System Administration category).

The remainder of this chapter describes configuration of &kdm; via the &systemsettings; module, and the next chapter describes the options available in &kdmrc; itself. If you only need to configure for local users, the &systemsettings; module should be sufficient for your needs. If you need to configure remote logins, or have multiple &kdm; sessions running, you will need to read on.

&Thomas.Tanghus; &Thomas.Tanghus.mail;
&Steffen.Hansen; &Steffen.Hansen.mail;
&Mike.McBride; &Mike.McBride.mail;

### The Login Manager &systemsettings; Module

Using this module, you can configure the &kde; graphical login manager, &kdm;. You can change how the login screen looks, who has access using the login manager and who can shutdown the computer.

All settings will be written to the configuration file &kdmrc;, which in its original state has many comments to help you configure &kdm;. Using this &systemsettings; module will strip these comments from the file. All available options in &kdmrc; are covered in .

The options listed in this chapter are cross referenced with their equivalents in &kdmrc;. All options available in the &systemsettings; module are also available directly in &kdmrc; but the reverse is not true.

In order to organize all of these options, this module is divided into several sections: General, Dialog, Background, Theme, Shutdown, Users and Convenience.

You can switch between the sections using the tabs at the top of the window.

You can only make changes if you run this module with superuser rights.

#### General

First you have a drop down box to choose the language for your login box, corresponding to setting `Language` in &kdmrc;.

In the Appearance section you have an option to use &kdm; in themed mode. If Use themed greeter is checked, the settings on the Dialog and Background pages cannot be configured separately.

While &kde;'s style depends on the settings of the user logged in, the style used by &kdm; can be configured using the GUI style: and Color scheme: options. These correspond to the keys `GUIStyle` and `ColorScheme` in &kdmrc; respectively.

From the Fonts section of this page you can change the fonts used in the login window. Only fonts available to all users are available here, not fonts you have installed on a per user basis.

You can select three different font styles in this section (General:, Failure:, Greeting:). When you click on the Choose... button a dialog appears from which you can select the new characteristics for the font style.

- The General: font is used in all other places in the login window.

- The Failure: font is used when a login fails.

- The Greeting: font is the font used for the title (Greeting String).

You can also check the box labeled Use anti-aliasing for fonts if you want smoothed fonts in the login dialog.

#### Dialog

From this page you can change the visual appearance of &kdm;, &kde;'s graphical login manager in non themed mode.

The Greeting: is the title of the login screen. Setting this is especially useful if you have many servers users may log in to. You may use various placeholders, which are described along with the corresponding key `GreetString` in &kdmrc;.

You can then choose to show either the current system time, a logo or nothing special in the login box. Make your choice in the radio buttons labeled Logo area:. This corresponds to `LogoArea` in &kdmrc;

If you chose Show logo you can now choose a logo:

- Drop an image file on the image button.

- Click on the image button and select a new image from the image chooser dialog.

If you do not specify a logo, the default `$`KDEDIR`/share/apps/kdm/pics/kdelogo.xpm` will be displayed.

Normally the login box is centered on the screen. Drag the anchor to move the center of the dialog to the desired position. Keyboard control is possible as well: Use the arrow keys or Home to center. Note that the actual proportions of the dialog are probably different. These correspond to the key `GreeterPos` in &kdmrc;.

#### Background

Here you can change the desktop background which will be displayed before a user logs in. Selecting Enable background allows you to edit the options on this tab.

This tab is comprised of three areas:

1. An area for selecting background images

2. The background Preview Monitor

3. An area for determining the background color

Preview Monitor

  This is a preview window. It will give you a sense of what to expect with each change.

Background

  This section allows you to load a wallpaper on top of the color gradient chosen in the section below.

  There are three choices available here:

  No Picture

    No picture background will be shown. The color and pattern choices below will still take effect.

  Picture

    A single picture will be used as the background for the selected desktops.

    How this picture is positioned and scaled can be fine tuned below.

  Slide show

    &kde; allows you to have an automatic slide show of wallpaper images. To enable this option, press the Setup... button. In the resulting dialog you may choose any image or folder of images available on your computer, using the Add... button to navigate your file system. Remove will remove the currently selected entry from the list.

    You may choose the length of time any image is displayed in the Change picture after: box, and you may choose Show pictures in random order if you don't want them displayed in the order they are listed.

    Displaying wallpaper requires that the image be kept in memory. If you are low on memory, using a small, tiled image or none at all is recommended.

    Scaling or centering a small image still requires an image the size of your display to be maintained in memory.

Options

  Position:

  Centered

    The image will be centered on the screen without changing the size of the image. The background colors will be present anywhere the image does not cover.

  Tiled

    The image will be duplicated until it fills the entire desktop. The first image will be placed in the upper left corner of the screen, and duplicated downward and to the right.

  Center Tiled

    The image will be duplicated until it fills the entire desktop. The first image will be placed in the center of the screen, and duplicated upward, downward to the right, and to the left.

  Centered Maxpect

    The image will be placed in the center of the screen. It will be scaled to fit the desktop, but it will not change the aspect ratio of the original image. This will provide you with an image that is not distorted.

  Tiled Maxpect

    The image will be placed in the corner of the screen. It will be scaled to fit the desktop, but it will not change the aspect ratio of the original image. This will provide you with an image that is not distorted. If there is any space over, the image will be duplicated to fill it.

  Scaled

    The image will be scaled to fit the desktop. It will be stretched to fit to all four corners. This may distort the image.

  Centered Auto fit

    If the picture fits the desktop size, this mode works like the centered option. If the picture is larger than the desktop then it is scaled down to fit while keeping the aspect ratio.

  Scale & Crop

    Magnify the picture without distorting it until it fills both the width and height of the desktop (cropping the picture if necessary), and then center it on the desktop.

  Colors:

    The first drop down box allows you to choose the type of color, gradient, or pattern to display under (or in place of) wallpaper.

    If you are going to be using a picture as a wallpaper, you can skip this section of the dialog box.

    However, if your chosen wallpaper does not cover the entire desktop, the chosen colors will still show in the remaining space.

    Single Color

      By choosing this mode, you select one color using the first color bar, and the entire background is covered with this one color.

    Horizontal Gradient

      By choosing this mode, you select two colors (using both color buttons). &kde; will then start with the primary color selected with the left button on the left edge of the screen, and slowly transform into the blend color selected with the right button by the time it gets to the right edge of the screen.

    Vertical Gradient

      By choosing this mode, you select two colors (using both color buttons). &kde; will then start with the primary color selected with the left button on the top edge of the screen, and slowly transform into the blend color selected with the right button as it moves to the bottom of the screen.

    Pyramid Gradient

      By choosing this mode, you select two colors (using both color buttons). &kde; will then start with the primary color selected with the left button in each corner of the screen, and slowly transform into the blend color selected with the right button as it moves to the center of the screen.

    Pipecross Gradient

      By choosing this mode, you select two colors (using both color buttons). &kde; will then start with the primary color selected with the left button in each corner of the screen, and slowly transform into the blend color selected with the right button as it moves to the center of the screen. The shape of this gradient is different than the pyramid gradient.

    Elliptic Gradient

      By choosing this mode, you select two colors (using both color buttons). &kde; will then start with the blend color selected with the right button in the center of the screen, and slowly transform into the primary color selected by the left button as it moves to the edges, in an elliptical pattern.

    Pattern

      The rest of the list are the names of various patterns or textures you can choose.

      For more on patterns, see the section Adding, Removing and Modifying Patterns.

      Select the primary color with the first color bar. If you have chosen a pattern that requires two colors to be set the secondary color can be set by pressing the appropriate button.

  Blending:

    The drop down box labeled Blending: contains the options to make a smooth transition (blend) from the wallpaper as it changes to the background.

    1. A drop down box allows you to select the blending mode. Many of the modes are similar to blending modes for background colors. Select your mode from the list, and the preview window shows you what it will look like.

    2. The Balance slider adjusts the blending. The results can be seen immediately in the preview window.

    3. The Reverse roles can reverse the role of the picture and the background for some types of blending.

##### Advanced options

Located below the preview monitor is a button labeled Advanced Options.

To use an external program to determine and change the background of &kde;, simply select Use the following program for drawing the background. Available &kde; programs are listed, select one to enable it.

##### Adding, Removing and Modifying Wallpapers and Patterns

There is a button under the preview monitor labeled Get New Wallpapers that helps you fetch new wallpaper images from a selection of popular images from the KDE-Look website. You can of course select any image you have available to use as wallpaper, and it may be stored in any location on your hard drive. To have a wallpaper show up in the list automatically for all users, you should save it to the `$`KDEDIR`/share/wallpapers` folder.

A pattern is a picture file which &kde; uses as a template to draw your background. The picture file provides the shapes, but &kde; provides the colors. &kde; is packaged with several patterns, and you also can add new patterns.

To add a new pattern that is available to every user on your computer, simply place the file in `$`KDEDIR`/share/apps/kdm/patterns/`.

Copy a `.desktop` file from this folder, and name it the same as your new pattern image file. Modify the contents to suit your new pattern.

To add a new pattern for a single user, add the files to `$`KDEHOME`/share/apps/kdm/patterns/`.

For best results, the pattern should be a grayscale PNG file.

#### Theme

This page consists of three sections:

A list of installed themes, where you can select the one to be used.

A screenshot with a preview of the selected theme and additional information like Copyright and Description.

Three buttons to install or remove a theme and a button to launch the Get Hot New Stuff dialog where you can download new themes.

The settings on this page are only available in themed mode.

#### Shutdown

Allow Shutdown

Use this drop down box to choose who is allowed to shut down:

- Nobody: No one can shutdown the computer using &kdm;. You must be logged in, and execute a command.

- Everybody: Everyone can shutdown the computer using &kdm;.

- Only Root: &kdm; requires that the root password be entered before shutting down the computer.

You can independently configure who is allowed to issue a shutdown command for the Local: and Remote: users.

Commands

Use these text fields to define the exact shutdown command.

The Halt: command defaults to `/sbin/halt`. The Reboot: command defaults to `/sbin/reboot`.

When Boot manager is set to Grub or Lilo, &kdm; will on reboot offer you options for these boot managers. Note that this option is not available on all operating systems.

#### Users

From here you can change the way users are represented in the login window.

Independently of the users you specify by name, you can use the System UIDs to specify a range of valid UIDs that are shown in the list. By default user id's under 1000, which are often system or daemon users, and user id's over 30000, are not shown.

You may disable the user list in &kdm; entirely in the Users section. You can choose from:

Show list

  Only show users you have specifically not excluded in the list alongside

  If you do not check this box, no list will be shown. This is the most secure setting, since an attacker would then have to guess a valid login name as well as a password. It is also the preferred option if you have more than a handful of users to list, or the list itself would become unwieldy.

Autocompletion

  If this option is checked, &kdm; will automatically complete user names while they are typed in the line edit.

Inverse selection

  Allows you to instead select a list of users that should be shown, and all other users will not be listed.

You can also enable the Sort users checkbox, to have the user list sorted alphabetically. If this is disabled, users will appear in the order they are listed in the password file. &kdm; will also autocomplete user names if you enable the Autocompletion option.

If you choose to show users, then the login window will show images (which you select), of a list of users. When someone is ready to login, they may select their user name/image, enter their password, and they are granted access.

If you permit a user image, then you can configure the User Image Source:

Here you can specify where &kdm; will obtain the images that represent users. System represents the global folder; these are the pictures you can set below. User means that &kdm; should read the user's `$`HOME`/.face.icon` file. The two selections in the middle define the order of preference if both sources are available.

If you choose not to show users, then the login window will be more traditional. Users will need to type their username and password to gain entrance. This is the preferred way if you have many users on this terminal.

#### Convenience

In the Convenience tab you can configure some options that make life easier for lazy people, like automatic login or disabling passwords.

Please think more than twice before using these options. Every option in the Convenience tab is well-suited to seriously compromise your system security. Practically, these options are only to be used in a completely non-critical environment, ⪚ a private computer at home.

##### Automatic Login

Automatic login will give anyone access to a certain account on your system without doing any authentication. You can enable it using the option Enable Auto-Login.

You can choose the account to be used for automatic login from the list labeled User:.

With Lock session the automatically started session will be locked immediately (provided it is a &kde; session). This can be used to obtain a super-fast login restricted to one user.

Automatic login can be suppressed by pressing the &Shift; key immediately after the &X-Server; switches to graphics mode and releasing it when &kdm;'s hourglass cursor appears.

##### Preselected User

You can also choose which user is preselected when &kdm; starts. The default is None, but you can choose Previous to have &kdm; default to the last successfully logged in user, or you can Specify a particular user to always be selected from the list. You can also have &kdm; set the focus to the password field, so that when you reach the &kdm; login screen, you can type the password immediately.

##### Password-Less Login

Using this feature, you can allow certain users to login without having to provide their password. Enable this feature using the Enable Password-Less Logins option.

Below this option you'll see a list of users on the system. Enable password-less login for specific users by checking the checkbox next to the login names. By default, this feature is disabled for all users.

Again, this option should only be used in a safe environment. If you enable it on a rather public system you should take care that only users with heavy access restrictions are granted password-less login, ⪚ guest.

The Automatically login after X server crash option allows you to skip the authentication procedure when your X server accidentally crashed.

&kdmrc-ref; &theme-ref;

## Configuring your system to use &kdm;

This chapter assumes that your system is already configured to run the &X-Window;, and that you only need to reconfigure it to allow graphical login.

### Setting up &kdm;

The fundamental thing that controls whether your computer boots to a terminal prompt (console mode) or a graphical login prompt is the default runlevel. The runlevel is set by the program /sbin/init under the control of the configuration file `/etc/inittab`. The default runlevels used by different &UNIX; systems (and different &Linux; distributions) vary, but if you look at `/etc/inittab` the start of it should be something like this:

    # Default runlevel. The runlevels used by RHS are:
    # 0 - halt (Do NOT set initdefault to this)
    # 1 - Single user mode
    # 2 - Multiuser, without NFS
    # 3 - Full multiuser mode
    # 4 - unused
    # 5 - X11
    # 6 - reboot (Do NOT set initdefault to this)

    id:3:initdefault:

All but the last line of this extract are comments. The comments show that runlevel 5 is used for X11 and that runlevel 3 is used for multi-user mode without X11 (console mode). The final line specifies that the default runlevel of the system is 3 (console mode). If your system currently uses graphical login (for example, using &xdm;) its default runlevel will match the runlevel specified for X11.

The runlevel with graphical login (&xdm;) for some common &Linux; distributions is:

- 5 for &RedHat; 3.x and later, and for &Mandrake;

- 4 for Slackware

- 3 for &SuSE;. 4.x and 5.x

The first step in configuring your system is to ensure that you can start &kdm; from the command line. Once this is working, you can change your system configuration so that &kdm; starts automatically each time you reboot your system.

To test &kdm;, you must first bring your system to a runlevel that does not run &xdm;. To do so, issue a command like this:

    /sbin/init 3

Instead of the number `3` you should specify the appropriate runlevel for console mode on your system.

If your system uses Pluggable Authentication Modules (PAM), which is normal with recent &Linux; and &Solaris; systems, you should check that your PAM configuration permits login through the service named `kde`. If you previously used &xdm; successfully, you should not need to make any changes to your PAM configuration in order to use &kdm;. `/etc/pam.conf` or `/etc/pam.d/kde`. Information on configuring PAM is beyond the scope of this handbook, but PAM comes with comprehensive documentation (try looking in `/usr/share/doc/*pam*/html/`).

Now it's time for you to test &kdm; by issuing the following command:

    kdm -nodaemon

If you get a &kdm; login dialog and you are able to log in, things are going well. The main thing that can go wrong here is that the run-time linker might not find the shared &Qt; or &kde; libraries. If you have a binary distribution of the &kde; libraries, make sure &kdm; is installed where the libraries believe &kde; is installed and try setting some environment variables to point to your &kde; and &Qt; libraries.

For example:

    export
    KDEDIR=/opt/kde
    export
    QTDIR=/usr/lib/qt4
    export
    PATH=$KDEDIR/bin:$QTDIR/bin:$PATH
    export
    LD_LIBRARY_PATH=$KDEDIR/lib:$QTDIR/lib

If you are still unsuccessful, try starting &xdm; instead, to make sure that you are not suffering from a more serious X configuration problem.

When you are able to start &kdm; successfully, you can start to replace &xdm; by &kdm;. Again, this is distribution-dependent.

- For &RedHat;, edit `/etc/inittab`, look for this line:

      x:5:respawn:/usr/X11/bin/xdm -nodaemon

  and replace with:

      x:5:respawn:/opt/kde/bin/kdm

  This tells `init`(8) to respawn &kdm; when the system is in run level 5. Note that &kdm; does not need the `-nodaemon` option.

- For &Mandrake;, the X11 runlevel in `/etc/inittab` invokes the shell script `/etc/X11/prefdm`, which is set up to select from amongst several display managers, including &kdm;. Make sure that all the paths are correct for your installation.

- For &SuSE;, edit `/sbin/init.d/xdm` to add a first line:

      . /etc/rc.config
      DISPLAYMANAGER=kdm
      export DISPLAYMANAGER

- For FreeBSD, edit `/etc/ttys` and find the line like this:

      ttyv8   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure

  and edit it to this:

      ttyv8   "/opt/kde/bin/kdm"  xterm   on secure

- Most other distributions are a variation of one of these.

At this stage, you can test &kdm; again by bringing your system to the runlevel that should now run &kdm;. To do so, issue a command like this:

    /sbin/init 5

Instead of the number `5` you should specify the appropriate runlevel for running X11 on your system.

The final step is to edit the initdefault entry in `/etc/inittab` to specify the appropriate runlevel for X11.

Before you make this change, ensure that you have a way to reboot your system if a problem occurs. This might be a rescue floppy-disk provided by your operating system distribution or a specially-designed rescue floppy-disk, such as `tomsrtbt`. Ignore this advice at your peril.

This usually involves changing the line:

    id:3:initdefault:

to

    id:5:initdefault:

When you reboot your system, you should end up with the graphical &kdm; login dialog.

If this step is unsuccessful the most likely problem is that the environment used at boot time differs from the environment that you used for testing at the command line. If you are trying to get two versions of &kde; to co-exist, be particularly careful that the settings you use for your `PATH` and `LD_LIBRARY_PATH` environment variables are consistent, and that the startup scripts are not over-riding them in some way.

## Supporting multiple window managers

&kdm; detects most available window managers and desktop environments when it is run. Installing a new one should make it automatically available in the &kdm; main dialog's Session Type submenu.

If you have a very new window manager, or something that &kdm; does not support, the first thing you should check is that the executable to be run is in the `PATH` and has not been renamed by the distributor into something unexpected.

If the case is that the session type is not supported by &kdm; yet (maybe because it is too new), you can quite easily add it.

The session types are defined by .desktop files located in the directories listed in `SessionsDirs`. The last named directory contains the system-provided default session types and is `$`KDEDIR`/share/apps/kdm/sessions` in an installation from source. Software upgrades will typically overwrite anything in here, so it is unwise to use it for configuration purposes. Instead, a separate configuration directory should be listed first. It is set to `$`KDEDIR`/share/config/kdm/sessions` in an installation from source, but distributors often change it to something like `/etc/kde4/kdm/sessions`. You can simply add an appropriately named `.desktop` files here. The fields are:

    [Desktop Entry]
    Encoding=UTF-8 This is fixed to UTF-8 and
    may be omitted
    Type=XSession This is fixed to XSession and
    may be omitted
    Exec=executable name Passed to
    eval exec in a Bourne shell
    TryExec=executable name Supported
    but not required
    Name=name to show in the &kdm; session list

There are also three magic types:

default

  The default session for &kdm; is normally &kde; but can be configured by the system administrator.

custom

  The Custom session will run the user's ~/.xsession if it exists, falling back to the default session otherwise.

failsafe

  Failsafe will run a very plain session, and is useful only for debugging purposes.

To override a session type, copy the .desktop file from the data dir to the config dir and edit it at will. Removing the shipped session types can be accomplished by shadowing them with .desktop files containing Hidden=true. For the magic session types no .desktop files exist by default, but &kdm; pretends they would, so you can override them like any other type.

## Using &kdm; for Remote Logins (&XDMCP;)

&XDMCP; is the Open Group standard, the X Display Manager Control Protocol. This is used to set up connections between remote systems over the network.

&XDMCP; is useful in multiuser situations where there are users with workstations and a more powerful server that can provide the resources to run multiple X sessions. For example, &XDMCP; is a good way to reuse old computers - a Pentium or even 486 computer with 16 Mb RAM is sufficient to run X itself, and using &XDMCP; such a computer can run a full modern &kde; session from a server. For the server part, once a single &kde; (or other environment) session is running, running another one requires very few extra resources.

However, allowing another method of login to your machine obviously has security implications. You should run this service only if you need to allow remote X Servers to start login sessions on your system. Users with a single &UNIX; computer should not need to run this.

## Advanced Topics

### Command Sockets

This is a feature you can use to remote-control &kdm;. It's mostly intended for use by &ksmserver; and &kdesktop; from a running session, but other applications are possible as well.

The sockets are &UNIX; domain sockets which live in subdirectories of the directory specified by `FifoDir`=. The subdir is the key to addressing and security; the sockets all have the file name `socket` and file permissions `rw-rw-rw-` (0666). This is because some systems don't care for the file permission of the socket files.

There are two types of sockets: the global one (dmctl) and the per-display ones (dmctl-<display>).

The global one's subdir is owned by root, the subdirs of the per-display ones' are owned by the user currently owning the session (root or the logged in user). Group ownership of the subdirs can be set via FifoGroup=, otherwise it's root. The file permissions of the subdirs are rwxr-x--- (0750).

The fields of a command are separated by tabs (\t), the fields of a list are separated by spaces, literal spaces in list fields are denoted by \s.

The command is terminated by a newline (\n).

The same applies to replies. The reply on success is ok, possibly followed by the requested information. The reply on error is an errno-style word (⪚ perm, noent, &etc;) followed by a longer explanation.

Global commands:

`login` `display` (now | schedule) user password [session_arguments]

  login user at specified display. if now is specified, a possibly running session is killed, otherwise the login is done after the session exits. session_arguments are printf-like escaped contents for .dmrc. Unlisted keys will default to previously saved values.

`resume`

  Force return from console mode, even if TTY logins are still active.

`manage` display [display_class [auth_name auth_data]]

  Start managing the named foreign display.

  display_class, if specified and non-empty, will be used for configuration matching; see .

  auth_name and auth_data need to be passed if the display requires X authorization. The format is the same as the 2nd and 3rd column of the `xauth list` output.

`unmanage` display

  Stop managing the named foreign display.

Per-display commands:

`lock`

  The display is marked as locked. If the &X-Server; crashes in this state, no auto-relogin will be performed even if the option is on.

`unlock`

  Reverse the effect of `lock`, and re-enable auto-relogin.

`suicide`

  The currently running session is forcibly terminated. No auto-relogin is attempted, but a scheduled "login" command will be executed.

Commands for all sockets

`caps`

  Returns a list of this socket's capabilities:

  kdm

    identifies &kdm;, in case some other DM implements this protocol, too

  list, lock, suicide, login, resume, manage

    The respective command is supported

  bootoptions

    The `listbootoptions` command and the `=` to `shutdown` are supported

  shutdown <list>

    `shutdown` is supported and allowed for the listed users (a comma separated list.) * means all authenticated users.

  nuke <list>

    Forced shutdown may be performed by the listed users.

  nuke

    Forced shutdown may be performed by everybody

  reserve <number>

    Reserve displays are configured, and number are available at this time

`list` [all | alllocal]

  Return a list of running sessions. By default all active sessions are listed (this is useful for a shutdown warning). If all is specified, passive sessions are listed as well. If alllocal is specified, passive sessions are listed as well, but all incoming remote sessions are skipped (this is useful for a fast user switching agent).

  Each session entry is a comma separated tuple of:

  - Display or TTY name

  - VT name for local sessions, remote host name prefixed by `@` for remote TTY sessions, otherwise empty

  - Logged in user's name, empty for passive sessions and outgoing remote sessions (local chooser mode)

  - Session type for active local sessions, remote hostname for outgoing remote sessions, empty for passive sessions.

  - A Flag field:

    - `*` for the display belonging to the requesting socket.

    - `!` for sessions that cannot be killed by the requesting socket.

    - `t` for TTY sessions.

  New fields may be added in the future.

`reserve`

  Start a reserve login screen. If nobody logs in within some time, the display is removed again. When the session on the display exits, the display is removed, too.

  Permitted only on sockets of local displays and the global socket.

`activate` (vt|display)

  Switch to a particular VT (virtual terminal). The VT may be specified either directly (⪚ vt3) or by a display using it (eg; :2).

  Permitted only on sockets of local displays and the global socket.

`listbootoptions`

  List available boot options.

  The return value contains these tokens:

  - A list of boot options (as shown in &kdm; itself).

  - The default boot option.

  - The current boot option.

  The default and current option are zero-based indices into the list of boot options. If either one is unset or not determinable, it is -1.

`shutdown` (reboot | halt) [=bootchoice] (ask|trynow|forcenow|schedule|start (-1|end (force|forcemy|cancel))))

  Request a system shutdown, either a reboot or a halt/poweroff.

  An OS choice for the next boot may be specified from the list returned by `listbootoptions`

  Shutdowns requested from per-display sockets are executed when the current session on that display exits. Such a request may pop up a dialog asking for confirmation and/or authentication

  start is the time for which the shutdown is scheduled. If it starts with a plus-sign, the current time is added. Zero means immediately.

  end is the latest time at which the shutdown should be performed if active sessions are still running. If it starts with a plus-sign, the start time is added. -1 means wait infinitely. If end is through and active sessions are still running, &kdm; can do one of the following:

  - cancel - give up the shutdown

  - force - shut down nonetheless

  - forcemy - shut down nonetheless if all active sessions belong to the requesting user. Only for per-display sockets.

  start and end are specified in seconds since the &UNIX; epoch.

  trynow is a synonym for 0 0 cancel, forcenow for 0 0 force and schedule for 0 -1.

  ask attempts an immediate shutdown and interacts with the user if active sessions are still running. Only for per-display sockets.

`shutdown cancel` [local|global}

  Cancel a scheduled shutdown. The global socket always cancels the currently pending shutdown, while per-display sockets default to cancelling their queued request.

`shutdown status`

  Return a list with information about shutdowns.

  The entries are a comma-separated tuples of:

  - (global|local) - pending vs. queued shutdown. A local entry can be returned only by a per-display socket.

  - (halt|reboot)

  - start

  - end

  - ("ask"|"force"|"forcemy"|"cancel")

  - Numeric user ID of the requesting user, -1 for the global socket.

  - The next boot OS choice or "-" for none.

  New fields might be added later

There are two ways of using the sockets:

- Connecting them directly. FifoDir is exported as $`DM_CONTROL`; the name of per-display sockets can be derived from $`DISPLAY`.

- By using the `kdmctl` command (⪚ from within a shell script). Try `kdmctl` `-h` to find out more.

Here is an example bash script reboot into FreeBSD:

    if kdmctl | grep -q shutdown; then
      IFS=$'\t'
      set -- `kdmctl listbootoptions`
      if [ "$1" = ok ]; then
        fbsd=$(echo "$2" | tr ' ' '\n' | sed -ne 's,\\s, ,g;/freebsd/I{p;q}')
        if [ -n "$fbsd" ]; then
          kdmctl shutdown reboot "=$fbsd" ask > /dev/null
        else
          echo "FreeBSD boot unavailable."
        fi
      else
        echo "Boot options unavailable."
      fi
    else
      echo "Cannot reboot system."
    fi

## Other sources of information

Since &kdm; is descended from &xdm;, the xdm man page may provide useful background information. For X-related problems try the man pages X and startx. If you have questions about &kdm; that are not answered by this handbook, take advantage of the fact the &kdm; is provided under the terms of the &GNU; General Public License: look at the source code.

## Credits and License

&kdm; is derived from, and includes code from, &xdm; © Keith Packard, MIT X Consortium.

&kdm; 0.1 was written by &Matthias.Ettrich;. Later versions till &kde; 2.0.x were written by &Steffen.Hansen;. Some new features for &kde; 2.1.x and a major rewrite for &kde; 2.2.x made by &Oswald.Buddenhagen;.

Other parts of the &kdm; code are copyright by the authors, and licensed under the terms of the &GNU; GPL. Anyone is allowed to change &kdm; and redistribute the result as long as the names of the authors are mentioned.

&kdm; requires the &Qt; library, which is copyright Troll Tech AS.

Documentation contributors:

- Documentation written by &Steffen.Hansen; &Steffen.Hansen.mail;

- Documentation extended by Gregor Zumsteinzumstein@ssd.ethz.ch. Last update August 9, 1998

- Documentation revised for &kde; 2 by &Neal.Crook; &Neal.Crook.mail;. Last update August 6, 2000

- Documentation extended and revised for &kde; 2.2 and 4.0 by &Oswald.Buddenhagen; &Oswald.Buddenhagen.mail;. Last update December 7, 2007

Documentation copyright &Steffen.Hansen;, Gregor Zumstein, &Neal.Crook; and &Oswald.Buddenhagen;. This document also includes large parts of the &xdm; man page, which is © Keith Packard. The theme format documentation is heavily based on the GDM manual, which is © Martin K. Petersen, George Lebl, &RedHat;, Inc. and Sun Microsystems, Inc.

&underFDL;

## Glossary

greeter

  The greeter is the login dialog, &ie; the part of &kdm; which the user sees.

entropy

  The entropy of a system is the measure of its unpredictability. This is used during the generation of random numbers.