Question about XDM

Polytropon freebsd at
Sun Apr 13 15:46:17 UTC 2014

On Sun, 13 Apr 2014 07:46:13 -0400, Antoine Kallab wrote:
> I am trying to set up XDM. I want it to drop me in to a minimal TWM session
> after I log in. Right now, it just flashes the screen and puts me back at
> the login window.

This usually indicates a missing ~/.xsession in the user's home
directory (as we can assume that X is already running correctly).

> From what I read in the handbook, there are a few configuration files in
> /usr/local/lib/X11/xdm that I need to change to get it to sing and dance in
> the way I want it to.

There are several files to adjust the look and feel as well as
the login and logout actions that xdm should take. Those are
on the "global" level and independent from individual user
settings. Those can be things the user cannot do on his own,
due to permissions, for example change device ownership or
access permissions to devices, files or directories.

> If I remember correctly, it was Xsession that controlled what happened
> after a user logs in.

The file is ~/.xsession. It has the same format as ~/.xinitrc
(which you can find examples for in The FreeBSD Handbook).

As I'm using xdm myself, allow me to show you the mechanism
I'm employing for being able to use both xdm as well as the
classical "startx": My .xsession simply sources .xinitrc and
makes sure that C-shell settings get honored (because the
csh still is my preferred _dialog_ shell):

% cat ~/.xsession
source ~/.cshrc
exec ~/.xinitrc

% cat ~/.xinitrc 
[ -f ~/.xmodmaprc ] && xmodmap ~/.xmodmaprc
# ... more "desktop-y" stuff here ...
xsetroot -solid rgb:3b/4c/7a
xset b 100 1000 15 &
xset r rate 250 30 &
xset s off &
xset -dpms &
exec wmaker

The last line specifies the desktop environment starter or
the window manager you want to use. Your X session lasts as
long as _this_ program is running. In my case, that would
be WindowMaker.

Note that the sheband line #!/bin/sh isn't needed in .xinitrc,
but it doesn't make things worse. :-)

Make sure both files get "chmod +x".

If you don't want to use "xinitrc" and always want to use xdm,
you can write the content I've shown for .xinitrc into .xsession

> Right now it is just an if/then loop that looks like it runs
> /usr/local/bin/xsm. Is that whole thing necessary? Can't I just tell it to
> run TWM?

See example above, just have "exec twm" instead. For twm
customization, see this great page:

Also refer to The FreeBSD Handbook:

You'll find everything I've mentioned (and more) there.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list