old-www/LDP/LG/issue43/nielsen.xdm.html

382 lines
12 KiB
HTML

<title> Configuring XDM -- a graphical login interface for Linux or UNIX</title>
<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Configuring XDM -- a graphical login interface for Linux or UNIX LG #43</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Configuring XDM -- a graphical login interface for Linux or UNIX</font></H1>
<H4>By <a href="mailto:mark@gtltd.com">Mark Nielsen</a></H4>
</center>
<P> <HR>
<EM>If this document changes, it will be available at
<a href="http://www.tcu-inc.com">The Computer Underground</a>:
<a href="http://www.tcu-inc.com/mark/articles/Kickstart.html">
http://www.tcu-inc.com/mark/articles/Kickstart.html</a>.</EM>
<br>CHANGES:
<ol>
<li> Changed XServers File located at /etc/X11/xdm/Xservers by adding
these lines to get 4 xdm sessions running so that 4 different people
can log in. It seems like all the neat stuff only happened on the last
session. It is probably easy to fix this. Perhaps I will mention it in
the next article.
<pre>
:0 A local /usr/X11R6/bin/X :0
:1 B local /usr/X11R6/bin/X :1
:2 C local /usr/X11R6/bin/X :2
:3 D local /usr/X11R6/bin/X :3
</pre>
</ol>
<hr>
<ol>
<li><a href="#Resources"> Resources</a>
<li><a href="#What"> What is XDM? -- the graphical login interface</a>
<li><a href="#Configs"> My configurations</a>
<li><a href="#conclusion">Conclusion</a>
</ol>
<hr>
<a name="Resources"></a>
<h1> Resources</h1>
<p>
<ol>
<li><a href="http://www.linuxgazette.com/issue42/carlson.html">
Chris Carlson's article</a> in the Linux Gazette.
<li>man xdm
<li><a href="http://www.tcu-inc.com/mark/projects/xdm/">
My old xdm cheat sheet</a> back in 12/1996 when I was just a hacker (in the
good sense). I guess this was around right when the Gazette got started?
How time flies. I should have posted this there at that time.
</ol>
<hr>
<a name="What"></a>
<h1> What is XDM?</h1>
To put it simply, xdm is just a graphical login screen so that you
can impress your boss or friends that you don't have some boring
console to look at when your computer starts up.
It just makes Linux a little bit more cool than
someone might have previously thought.
<p>
In theory, most of configurations here should work for any Linux
distribution. This is configured for RedHat 6.0 though. RedHat 6.0 uses
gdm instead of xdm when it starts its graphical login screen. However,
I haven't got gdm to work in the exact way I want it, even though it
seems much better than xdm. Once I figure out a few things, I will
write a brief article on gdm also.
<p>
Here are some things to note ,
<ol>
<li> If you want xdm (or gdm) to start when you computer starts, you need
to make sure this line<br>
id:3:initdefault:
<br> Looks like this <br>
id:5:initdefault:
<br> in the file "/etc/inittab". Please, whatever you do, get
Xwindows working before you set xdm to start at bootup. If Xwindows
doesn't work, xdm won't work, and that can cause problems.
<li> RedHat 6.0 switched to gdm instead of using xdm
which is apparent at the bottom of the
/etc/inittab with the line <br>
x:5:respawn:/etc/X11/prefdm -nodaemon
<br> thus, change that line to this,
<br> x:5:respawn:/usr/bin/X11/xdm -nodaemon
<li> All the files I am changing are in "/etc/X11/xdm".
</ol>
<hr>
<a name="Configs"></a>
<h1> My config files</h1>
I am only interested in a few files, namely
<br> /etc/X11/xdm/Xsetup_0
<br> /etc/X11/xdm/Xresources
<br> /etc/X11/xdm/GiveConsole
<br> /etc/rc.d/rc.change_graphic
<br> /etc/rc.d/rc.local
<br> /etc/inittab &lt;-- this was explained above
<br> and the gif files in /etc/X11/xdm/graphics/
<p>
Here is the goal, I want to change xdm to make it so it has xeyes,
santa, a clock, a graphics image, and my choice of background color
on the desktop before someone logs in. After they log in, I want santa
to die. Cruel huh?
<p>
Okay, let us do this in order:
<ol>
<li> Copy my <a href="#perl"> graphics perl script</a> to
"/etc/rc.d/rc.change_graphic". This changes the image which appears on
the screen. Images are stored in /etc/X11/xdm/graphics as gif files.
<li> Copy my <a href="#perlkill"> kill santa perl script</a> to
"/etc/X11/xdm/KillXsnow". This kills santa. Santa slows down the desktop.
<li> Copy my <a href="#Xsetup"> Xsetup script</a> to
"/etc/X11/xdm/Xsetup_0". Programs to run with the graphical
login screen.
<li> Copy my <a href="#Xresources"> Xresources script</a> to
"/etc/X11/xdm/Xresources". How the setup of xdm should look like.
<li> Copy my <a href="#GiveConsole"> GiveConsole script</a> to
"/etc/X11/xdm/GiveConsole". Stuff to get executed before Xwindows
is handed over to the user. Also, changes the background image for
xdm.
<li> Add <a href="#local"> this command </a> to "/etc/rc.d/rc.local".
Make sure we get a graphics image to look at when we boot up.
<li> Copy my <a href="http://www.tcu-inc.com/mark/articles/xdm/xdm.tgz">
gif files</a> to
"/etc/X11/xdm/graphics/" and issue this command on the file
<br>
tar -C / -zxvf xdm.tgz
<br> These are just my silly images I use.
</ol>
<hr>
<h1> Here are the rest of my config files:</h1>
<hr>
<a name=perl></a>
<h2> Change graphics perl script</h2>
Located at "/etc/rc.d/rc.change_graphic".
Issue the command "chmod 755 /etc/rc.d/rc.change_graphic" after it is
copied.
<pre>
#!/usr/bin/perl
@Files = &lt;/etc/X11/xdm/graphics/*.gif&gt;;
#print @Files;
$Length = @Files;
$Seconds = `date +%S`;
chomp $Second;
$Frac = $Seconds/60;
if (!($Frac > 0)) {$Frac=1}
$Random = $Frac*$Length;
($Random,$Junk) = split(/\./, $Random,2);
if (($Random < 1) || ($Random > $Length -1)) {$Random = 1}
$File = $Files[$Random];
$Rand2 = rand $Length;
($Rand2,$Junk) = split(/\./, $Rand2,2);
$Random = $Random + $Rand2;
if ($Random > $Length - 1) {$Random = $Random - $Length + 1;}
#print "$Length $Random $File\n";
if (-e "/etc/X11/xdm/xdm_front.gif") {system "rm /etc/X11/xdm/xdm_front.gif"}
if (@Files < 1)
{
## Some sort of error messege should be here.
}
else
{system "ln -s $File /etc/X11/xdm/xdm_front.gif";}
</pre>
<hr>
<a name=perlkill></a>
<h2> Kill Santa perl script</h2>
Located at "/etc/X11/xdm/KillXsnow".
Issue the command "chmod 755 /etc/X11/xdm/KillXsnow" after it is
copied.
<pre>
#!/usr/bin/perl
### I had to add the -a option between RH 5.2 and 6.0
@Temp = `cd /proc; grep -a ^/usr/X11R6/bin/xsnow /proc/[0-9]*/cmdline`;
if (@Temp > 0)
{
$Xsnow = shift @Temp;
($Junk,$ProcJunk,$No,$RestOfJunk) = split(?/?,$Xsnow);
## I am really paranoid that I want to kill the right pid
if (($No > 0) && ($Xsnow =~ ?^/proc/$No/cmdline:/usr/X11R6/bin/xsnow?))
{
# system "echo \"Killing pid $No for Xsnow.\n\" > /tmp/1.txt\n";
system "kill $No";
}
}
</pre>
<hr>
<a name=Xsetup></a>
<h2> Xsetup_0 script</h2>
Located at "/etc/X11/xdm/Xsetup_0".
Issue the command "chmod 755 /etc/X11/xdm/Xsetup_0". after it is
copied.
<pre>
#!/bin/sh
# $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $
/usr/X11R6/bin/xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail
#/usr/X11R6/bin/xbanner
### Santa and snowflakes
### On some installs, I am missing xsnow for some reason.
/usr/X11R6/bin/xsnow -snowflakes 50 -santa 2 -unsmooth &
### Load the random image
/usr/bin/X11/xloadimage -onroot -at 1,210 /etc/X11/xdm/xdm_front.gif -border brown &
### A clock would be nice to see
/usr/X11R6/bin/xclock -digital -update 1 -fn -adobe-times-medium-i-normal--34-240-100-100-p-168-iso8859-1 -geometry +410+1 &
### Let us turn on xeyes
/usr/X11R6/bin/xeyes -geometry +410+100 &
</pre>
<hr>
<a name=Xresources></a>
<h2> Xrsources file</h2>
Located at "/etc/X11/xdm/Xresources".
Issue the command "chmod 755 /etc/X11/xdm/Xresources" after it is
copied.
<pre>
! $XConsortium: Xresources /main/8 1996/11/11 09:24:46 swick $
xlogin*login.translations: #override\
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
Ctrl<Key>Return: set-session-argument(failsafe) finish-field()\n\
<Key>Return: set-session-argument() finish-field()
xlogin*borderWidth: 3
xlogin*geometry: 400x200+1+1
xlogin*greeting: CLIENTHOST
xlogin*namePrompt: login:\040
xlogin*fail: Login incorrect
#ifdef COLOR
xlogin*greetColor: CadetBlue
xlogin*failColor: red
*Foreground: black
*Background: #fffff0
#else
xlogin*Foreground: black
xlogin*Background: white
#endif
XConsole.text.geometry: 480x130
XConsole.verbose: true
XConsole*iconic: true
XConsole*font: fixed
Chooser*geometry: 700x500+100+100
Chooser*allowShellResize: false
Chooser*viewport.forceBars: true
Chooser*label.font: *-new century schoolbook-bold-i-normal-*-240-*
Chooser*label.label: XDMCP Host Menu from CLIENTHOST
Chooser*list.font: -*-*-medium-r-normal-*-*-230-*-*-c-*-iso8859-1
Chooser*Command.font: *-new century schoolbook-bold-r-normal-*-180-*
</pre>
<hr>
<a name=GiveConsole></a>
<h2> GiveConsole file</h2>
Located at "/etc/X11/xdm/GiveConsole".
<p>
All you have to do is add "/etc/X11/xdm/KillXsnow & " as the first command
in the file. Mine looks like this,
<pre>
#!/bin/sh
# Assign ownership of the console to the invoking user
# $XConsortium: GiveConsole,v 1.2 93/09/28 14:29:20 gildea Exp $
# By convention, both xconsole and xterm -C check that the
# console is owned by the invoking user and is readable before attaching
# the console output. This way a random user can invoke xterm -C without
# causing serious grief.
/etc/rc.d/rc.change_graphic &
/etc/X11/xdm/KillXsnow &
chown $USER /dev/console
/usr/X11R6/bin/sessreg -a -w "/var/log/wtmp" -u "/var/run/utmp" \
-x "/etc/X11/xdm/Xservers" -l $DISPLAY -h "" $USER
</pre>
<hr>
<a name=local></a>
<h2> /etc/rc.d/rc.local file </h2>
Add this to the /etc/rc.d/rc.local file.
<pre>
/etc/rc.d/rc.change_graphic
</pre>
<hr>
<a name="Conclusion"></a>
<h1> Conclusion</h1>
XDM is pretty cool. This is the old way of doing things. I recommend
going to gdm or something else. For XDM, I give it a B-. It just lacks
some of the stuff I always wanted to see that gdm has.
<p>
I will explain GDM next time. Gdm has
the nice capability of letting you choose which desktop environment
you want. In RedHat 6.0, you can choose KDE, GNOME, or other desktop
environments when you login, which is pretty cool. Overall, I give gdm
a B+, and if it becomes better documented, an A. Again, I hope to make
an article about gdm for the August issue.
<hr>
<i>
<a href="mailto:mark@tcu-inc.com">Mark</a>
works as a receptionist (shorts and tee-shirt)
under <a href="mailto:mike@tcu-inc.com"> Mike Hunter</a> at
<a href="http://www.tcu-inc.com"> The Computer Underground</a>
and as a professional (suit and tie) consultant at
<a href="http://www.800linux.com">
800linux.com</a>. In his spare time, he does volunteer stuff, like writing
these documents.
</i>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1999, Mark Nielsen<BR>
Published in Issue 43 of <i>Linux Gazette</i>, July 1999</H5></center>
<!--===================================================================-->
<!--startcut ==========================================================-->
<P> <hr> <P>
<A HREF="index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="nielsen.kickstart.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="scheidler.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
</BODY>
</HTML>
<!--endcut ============================================================-->