7.3. Objective 2: Set Up a Display ManagerThe display manager is the tool to manage X sessions on physical displays both locally and across the network. Part of its job is to handle user authentication through a graphical login screen, which replaces the familiar text-mode login. 7.3.1. Configuring xdmxdm is distributed as part of XFree86 and is configured by a series of files located in /etc/X11/xdm. These files include:
7.3.1.1. Running xdm manuallyxdm uses the X server to run on your local display. Therefore, you must have a working X configuration prior to using a display manager. Then, to start xdm, simply enter it as root: # xdm xdm launches the X server and display the graphical login, and you can log in as usual. xdm then starts your graphical environment. After you log out, xdm resets and again displays the login screen. Most Linux distributions enable virtual consoles. You can switch among them using the key combinations Ctrl-Alt-F1, Ctrl-Alt-F2, and so on. (The Ctrl is only required while switching from an X console to a text or other X console.) Typically, the first six consoles are set up as text-mode screens, and X launches on console 7 (Ctrl-Alt-F7), or the first tty not running mingetty or some other getty process. This means that, as with startx, your original text-mode console remains unchanged after you manually start xdm. Therefore, you must log out of your text-mode console if you plan to leave the system unattended with xdm running manually . If you want to stop xdm, you first must be sure that all of the X sessions under its management are logged out. Otherwise, they'll die when xdm exits and you could lose data. Then simply stop the xdm process using kill or killall from a text console: # killall xdm Of course, xdm isn't very useful for your local system if you must always start it manually. That's why most Linux distributions include a boot-time option to start xdm for you, eliminating the text-mode login completely. 7.3.1.2. Running xdm automaticallyFor Linux systems using the System-V-style initialization, a runlevel is usually reserved for login under xdm. This line at the bottom of /etc/inittab instructs init to start xdm for runlevel 5: # Run xdm in runlevel 5 x:5:respawn:/usr/X11R6/bin/xdm -nodaemon Using this configuration, when the system enters runlevel 5, xdm starts and presents the graphical login as before. See Chapter 14 for more information on runlevels. It's also possible to automatically start xdm simply by adding it to the end of an initialization script, such as rc.local. This method offers less control over xdm but may be adequate for some situations and for Linux distributions that don't offer runlevels. 7.3.1.3. Basic xdm customizationYou may wish to personalize the look of xdm for your system. The look of the graphical login screen can be altered by manipulating the resources in /etc/X11/xdm/Xresources. (Note that Xresources uses ! to start comments.) For example, the following excerpt shows settings to control the greeting (Welcome to Linux on smp-pc), other prompts, and colors: ! Xresources file xlogin*borderWidth: 10 xlogin*greeting: Welcome to Linux on CLIENTHOST xlogin*namePrompt: Login:\040 xlogin*fail: Login incorrect - try again! xlogin*failColor: red xlogin*Foreground: Yellow xlogin*Background: MidnightBlue You can also include command-line options to the X server in /etc/X11/xdm/Xservers if you wish to override those found in XF86Config. For example, to change the default color depth, add the -bpp (bits per pixel) option for the local display: # Xservers file :0 local /usr/X11R6/bin/X -bpp 24 To include additional X programs or settings on the graphical login screen, put them in /etc/X11/xdm/Xsetup_0. In this example, the background color of the X display is set to a solid color (in hexadecimal form), and a clock is added at the lower righthand corner of the screen: #!/bin/sh # Xsetup /usr/X11R6/bin/xsetroot -solid "#356390" /usr/X11R6/bin/xclock -digital -update 1 -geometry -5-5 & Note that in this example, xsetroot exits immediately after it sets the color, allowing the Xsetup_0 script to continue. xclock, however, does not exit and must be put into the background using an & at the end of the command line. If such commands are not placed into the background, the Xsetup_0 script hangs, and the login display does not appear. 7.3.2. X TerminalsX terminals are a breed of low-cost display devices for X. They are usually diskless systems that implement an X server and drive a monitor. Such devices can be configured to access a remote host to find an xdm daemon or will broadcast to the entire network looking for a "willing host" to offer xdm services. The selected system will run an X session across the network with the X terminal as the target display. With this setup, a large number of relatively inexpensive X terminals can make use of a few high-powered host systems to run graphical clients. 7.3.2.1. xdm for X terminalsTo use an X terminal with your host, xdm must first be running on the host machine. The host listens for inbound connections from the X terminals using XDMCP, the xdm Control Protocol (the default port for xdmcp is 177). When a request is received, xdm responds with the same graphical login screen that's used on the local system. The difference is that the X server is implemented in the X terminal hardware, not in the XFree86 software on the xdm host, and all of the graphics information is transmitted over the network.
You can configure access to your system's xdm daemon in the /etc/X11/xdm/Xaccess file. This file is a simple list of hosts that are to be restricted or enabled. To enable a host, simply enter its name. To restrict a host, enter its name with an exclamation point (!) before it. The * wildcard is also allowed to handle groups of devices. The following example allows access to all X terminals on the local domain but prohibits access from xterm1 on an outside domain: *.example.com !xterm1.anotherexample.com |