the djb way

services, services!


xdm


Protocol: TCP
Standard Port: 177 (xdmcp)

xdm is the X Display Manager, a component of the X Window System used to manage any number of X sessions on local or remote servers.

Like other components of X, xdm is extremely feature-full, powerful and flexible. The combination of X and xdm provides the basis for highly sophisticated "thin-client"/"fat-server" network computing environments.

Or, more simply used, xdm (and the gdm and kdm derivatives from the Gnome and KDE projects) can simply provide your workstation with a nifty graphical login.

Of course, we aren't talking about running X on your bastion host servers here. For security reasons especially, that is technically known as Bad.

But for users' workstations inside the firewall, X11 is indispensable for increasing both the productivity and pleasure of computing, even for command-line purists.

As for xdm, not only can it give you a slick login and straight path to X, it is also perfect for shared workstations and kiosk applications.

And --no surprise-- daemontools is the best way to run xdm.

Here's the "run" script for /var/svc.d/xdm/run:


#!/bin/sh
# xdm/run
# daemontools run script for xdm
# ===
exec xdm -nodaemon

### that's all, folks!

As usual, make sure the script is executable, chmod 755.

This is about the simplest run script we have on our systems. The -nodaemon option is the trick that keeps xdm in the foreground as daemontools requires.

Note also that we don't even bother with a logging service for xdm. For one thing, xdm logs via syslog. For another, xdm provides its own visible feedback; it is pretty obvious when something isn't right. And once you get the xdm setup the way you like it, not much can go wrong, either.

Read your man page for xdm for all the details on configuration. Usually the files are somewhere like /etc/X11/xdm or /usr/X11R6/lib/X11/xdm. The default configuration is often plain and ugly. Put stuff like xsetroot into Xsetup_0 to get some background color on the login screen. Or, if you prefer wallpaper instead, use something like:

/usr/local/bin/xv -max -smooth -root -quit /path/to/wallpaper

Replace xv with your favorite image viewer. Edit Xresources to control size, color and placement of other login screen elements.

xdm also looks for an executable .xsession file in users' home directories, to load their favorite X window manager and startup applications.

When all is ready, just link into /service to start everything up:

# ln -s /var/svc.d/xdm /service/xdm

The login screen configured for xdm should pop up pronto.

xdm responds to a few signals, easily provided with the daemontools svc utility:

svc -u   start xdm
svc -d   stop xdm (don't restart):
terminate all client sessions
svc -h SIGHUP reload xdm configuration files:
current client sessions unaffected
svc -t SIGTERM stop xdm with SIGTERM:
terminate all client sessions
(will restart under daemontools)

The svc utility makes it easy to trouble-shoot and control xdm during configuration.

If you do tire of xdm, longing for a plain console login and startx, just put the service "down":

# touch /service/xdm/down
# svc -d /service/xdm

Then you can always bring it back up on command:

# svc -u /service/xdm

Copyright © 2004, Wayne Marshall.
All rights reserved.

Last edit 2004.04.26, wcm.