ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÅäÖÃXDM--Ò»ÖÖLinuxµÄͼÐεǼ½çÃæ

·¢²¼Ê±¼ä:2006-04-19 10:46:47À´Ô´:ºìÁª×÷Õß:chentong
±¾ÎĽö×ö²Î¿¼

±¾ÎĵÄ×î½ü¸üлá·ÅÔÚ The Computer Underground: http://www.tcu-inc.com/mark/articles/Kickstart.html.
Ð޸ģº
ͨ¹ýÔÚ /etc/x11/xdm/Xservers ÎļþÖмÓÈëÒÔϼ¸ÐУ¬¿ÉÒԵõ½Ëĸö xdm »á»°£¬ÓÉ´Ë¿ÉÒÔÔÊÐíËĸö²»Í¬Óû§µÇ¼¡£¿´ÉÏÈ¥ºÃÏóËùÓо«ÇɵÄËزÄÉèÖÃÖ»¶Ô×îºóÒ»¸ö»á»°Æð×÷Óᣲ»¹ý¿ÉÄܺÜÈÝÒ×ÐÞÕýÕâÒ»µã£¬Ò²ÐíÎÒ»áÔÚÏÂһƪÎÄÕÂÖÐÌáµ½¡£
: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

--------------------------------------------------------------------------------

×ÊÔ´
ʲôÊÇXDM£¿ -- Ò»ÖÖͼÐλ¯µÄµÇ¼½çÃæ
ÎÒµÄÅäÖÃ
½áÂÛ

--------------------------------------------------------------------------------

×ÊÔ´

Chris Carlson ÔÚLinux¹«±¨ÖеÄÎÄÕ¡£
man xdm
ÎÒÒÔǰдµÄÎĸ塣 ÕâЩÎĸåдÓÚ1996Äê12Ô£¬ÄÇʱÎÒ»¹ÊÇÒ»¸öhacker£¨ÕæÊÇÒ»ÖÖºÜÃÀÃîµÄ¸Ð¾õ£©¡£ÎÒÏëÄÇʱºîLinux¹«±¨Ò²¸Õ¿ªÊ¼·¢ÐС£Ê±¼ä¹ýµÄÕæ¿ì£¬ÎÒ±¾Ó¦µ±ÔÚÄÇʱºî¾Í·¢±íÕâƪÎÄÕµġ£

--------------------------------------------------------------------------------

ʲôÊÇXDM£¿
¼ò¶øÑÔÖ®£¬xdm Ö»²»¹ýÊÇÒ»ÖÖͼÐλ¯µÄµÇ¼½çÃæ¡£µ±ÄãµÄ¼ÆËã»úÆô¶¯µÄʱºòÄã¿ÉÒÔÈÃÄãµÄÀÏ°åºÍÅóÓÑÃǼÇסÄãµÄ¼ÆËã»úûÓÐÄÇÖÖÁîÈËÑá·³µÄ×Ö·û¿ØÖÆ̨½çÃæ¡£ÆäʵËü¾ÍÊÇÈÃÄãµÄLinux¿´ÉÏÈ¥±ÈËûÃÇÔ­ÏëµÄÒª¡°¿á¡±Ò»Ð©¡£
ÀíÂÛÉÏ˵,ËäÈ»ÕâÊÇÔÚRedhat 6.0µÄ»·¾³ÏÂÅäÖõģ¬µ«¶ÔÓÚÈκÎLinuxµÄdistributio n£¬´ó¶àÊýÅäÖÃÎļþ¶¼ÄÜÕý³£¹¤×÷¡£ µ±Æô¶¯Í¼ÐεǼ½çÃæµÄʱºò£¬Redhat 6.0 ʹÓõÄÊÇgdm£¬¶ø²»ÊÇxdm¡£ËäÈ»gdm¿´ÉÏÈ¥ Òª±ÈxdmºÃµÄ¶à£¬µ«ÎÒÏÖÔÚ»¹²»ÄÜÈÃgdmÏóÎÒÐèÒªµÄ·½Ê½ÔËÐС£Ò»µ©ÎÒ½â¾öÁËһЩÎÊÌ⣬ÎÒ »áÔÙдһƪ¹ØÓÚgdmµÄ¼òÒªÎÄÕ¡£

ÕâÀïÓÐһЩÐèҪעÒâµÄÊÂÏî ,

Èç¹ûÄãÏëÒªÄãµÄ xdm (»òÕß gdm) ÔÚ¼ÆËã»úÆô¶¯µÄʱºòÔËÐÐ,ÄãÓ¦¸ÃÈ·±£ÔÚÎļþ /etc/inittab ÖеÄÕâÒ»ÐÐ
id:3:initdefault:
Ϊ
id:5:initdefault:
Çë×¢Ò⣬ÎÞÂÛÄãÏë×öʲô£¬¶¼±ØÐëÔÚÄãÉèÖÃÆô¶¯Ê±ÔËÐÐ xdm֮ǰ£¬Ê¹ÄãµÄ Xwindows Õý³£¹¤×÷¡£Èç¹û Xwindows ÎÞ·¨Õý³£ÔËÐеĻ°£¬ÄãµÄxdm Ò²²»»áÕý³£ÔËÐУ¬¶øÇÒ»áÒýÆðÐí¶àÎÊÌâ¡£
´ÓÎļþ/etc/inittab µ×²¿µÄÕâÒ»ÐУ¬Äã¿ÉÒÔÇå³þµÄ¿´µ½RedHat 6.0 ʹÓÃÁËgdm À´´úÌæxdm
x:5:respawn:/etc/X11/prefdm -nodaemon
Òò´Ë°ÑÕâÒ»ÐиÄΪ,
x:5:respawn:/usr/bin/X11/xdm -nodaemon
ÎÒÐ޸ĵÄËùÓÐÎļþ¶¼ÔÚ "/etc/X11/xdm" Ŀ¼Ï¡£

--------------------------------------------------------------------------------

ÎÒµÄÅäÖÃÎļþ
ÎÒÖ»¶ÔÏÂÁм¸¸öÎļþ¸ÐÐËȤ£¬
/etc/X11/xdm/Xsetup_0
/etc/X11/xdm/Xresources
/etc/X11/xdm/GiveConsole
/etc/rc.d/rc.change_graphic
/etc/rc.d/rc.local
/etc/inittab <-- Õâ¸öÎļþÔÚÇ°ÃæÒѾ­½âÊ͹ýÁË ¡£
ÁíÍ⣬ͼÐÎÎļþλÓÚ /etc/X11/xdm/graphics/ Ŀ¼Ï¡£
ÎÒµÄÄ¿µÄÊǸıäxdmʹËü¾ßÓÐÒ»¸öxeyes£¬Ò»¸öÊ¥µ®ÀÏÈË£¬Ò»¸öÖÓ£¬Ò»¸öͼƬÒÔ¼°Ñ¡Ôñ ÔڵǼǰµÄ±³¾°É«¡£µÇ¼ºóÈÃÊ¥µ®ÀÏÈËËÀµô¡£¿á°É?

ºÃ°É£¬ÏÖÔÚÈÃÎÒÃÇÒ»²½Ò»²½µÄÀ´×ö£º

¿½±´ÎÒµÄ graphics perl script µ½"/etc/rc.d/rc.change_graphic"¡£Õâ¸öÎļþ¸Ä±äÁËÏÔʾÔÚÆÁÄ»ÉϵÄͼÐΡ£Í¼Ïñ×÷ΪgifÎļþ´æ´¢ÔÚ¡°/etc/x11/xdm/graphics¡±Ä¿Â¼Ï¡£
¿½±´ÎÒµÄkill santa perl script µ½ "/etc/X11/xdm/KillXsnow"¡£Õâ¸öÎļþɱËÀÁËÊ¥µ®ÀÏÈË£¬ËûÂýÂýµØµôÂä×ÀÃæ¡£
¿½±´ÎÒµÄ Xsetup script µ½ "/etc/X11/xdm/Xsetup_0". Õâ¸ö³ÌÐòºÍͼÐεǼ½çÃæÒ»ÆðÔËÐС£
¿½±´ÎÒµÄ Xresources script µ½ "/etc/X11/xdm/Xresources". Õâ¸öÎļþÉèÖÃÁËxdmµÄÍâ¹Û¡£
¿½±´ÎÒµÄ GiveConsole scriptµ½ "/etc/X11/xdm/GiveConsole". Õâ¸öÎļþ¾ö¶¨ÁËÔÚXwindowsÒƽ»¸øÓû§Ö®Ç°ÒªÖ´ÐеÄһЩ³ÌÐò¡£
°Ñ Õâ¸öÃüÁî ¼Óµ½ "/etc/rc.d/rc.local" ÎļþÖС£ÒÔÈ·±£ÔÚÆô¶¯µÄʱºòµÃµ½ÎÒÃǶ¨ÒåµÄͼÏñ ¡£
¿½±´ÎÒµÄ gif Îļþ µ½"/etc/X11/xdm/graphics/" Ŀ¼Ï£¬²¢ÇÒÖ´ÐÐ
tar -C / -zxvf xdm.tgz
ÕâЩ¾ÍÊÇÎÒʹÓõÄһЩͼÏó¡£

--------------------------------------------------------------------------------

ÕâÀïÊÇÅäÖÃÎļþµÄÆäÓಿ·Ö:

--------------------------------------------------------------------------------

Change graphics perl script
λÓÚ "/etc/rc.d/rc.change_graphic"¡£ ÔÚ¿½±´Ö®ºóÖ´ÐÐÃüÁî "chmod 755 /etc/rc.d/rc.change_graphic"¡£
#!/usr/bin/perl


@Files = ¡´/etc/X11/xdm/graphics/*.gif¡µ;


#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";}

--------------------------------------------------------------------------------

Kill Santa perl script
λÓÚ "/etc/X11/xdm/KillXsnow"¡£¿½±´ºóÖ´ÐÐ ÃüÁî "chmod 755 /etc/X11/xdm/KillXsnow" ¡£
#!/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";

}

}

--------------------------------------------------------------------------------

Xsetup_0 script
λÓÚ "/etc/X11/xdm/Xsetup_0"¡£¿½±´ºóÖ´ÐÐÃüÁî" chmod 755 /etc/X11/xdm/Xsetup_0"¡£
#!/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 &

--------------------------------------------------------------------------------

Xrsources file
λÓÚ "/etc/X11/xdm/Xresources"¡£¿½±´ºóÖ´ÐÐÃüÁî ¡°chmod 755 /etc/X11/xdm/Xresources" ¡£
! $XConsortium: Xresources /main/8 1996/11/11 09:24:46 swick $

xlogin*login.translations: #override\

CtrlR: abort-display()\n\

F1: set-session-argument(failsafe) finish-field()\n\

CtrlReturn: set-session-argument(failsafe) finish-field()\n\

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-*


--------------------------------------------------------------------------------

GiveConsole file
λÓÚ "/etc/X11/xdm/GiveConsole".
ÄãËùÒª×öµÄ¾ÍÊÇ°Ñ "/etc/X11/xdm/KillXsnow & " ×÷ΪµÚÒ»¸öÃüÁî¼ÓÈëÎļþ¡£ ÎÒµÄÊÇÕâÑùµÄ£¬

#!/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

--------------------------------------------------------------------------------

/etc/rc.d/rc.local file
°ÑÏÂÐÐÃüÁî¼ÓÈëÎļþ /etc/rc.d/rc.local ¡£
/etc/rc.d/rc.change_graphic

--------------------------------------------------------------------------------

½áÂÛ
XDM ·Ç³£¡°¿á¡±¡£ÕâÊÇÒ»ÖÖÀϵÄʵÏÖ·½·¨¡£ÎÒÍƼöʹÓÃgdm»òÕßÆäËüʲô¡£ ÎÒ¸ø XDM ´ò B- ¡£Ëüȱ·¦Ò»Ð©ÎÒÔç¾ÍÏ£Íû¿´µ½µÄgdmÓеĺõÄËزġ£
Ï´ÎÎÒ»á½âÊÍ GDM ¡£ Gdm ÓÐÒ»Öַdz£ºÃµÄÄÜÁ¦£¬¿ÉÒÔÈÃÄãÑ¡ÔñÄãÏëÒªµÄ¹¤×÷̨»·¾³ ¡£ÔÚRedHat 6.0 Ï£¬µ±ÄãµÇ¼ʱ¿ÉÒÔÑ¡Ôñ KDE £¬GNOME £¬»òÕßÆäËüµÄ¹¤×÷̨»·¾³£¬Õâ ÊǷdz£¡°¿á¡±µÄ¡£È«ÃæµÄ£¬ ÎÒ¸ø gdm ´ò B+ £¬¶øÇÒÈç¹ûËü±äµÄ¸üºÃ˵Ã÷µÄ»¯£¬¿ÉÒÔ´òA ¡£ÎÒÔÙ´ÎÏ£Íû¿ÉÒÔÔÙ°ËÔ¿¯ÉÏ·¢±í¹ØÓÚgdmµÄÎÄÕ¡£

--------------------------------------------------------------------------------

Mark works as a receptionist (shorts and tee--shirt) under Mike Hunter at The Computer Underground and as a professional (suit and tie) consultant at 800linux.com. In his spare time, he does volunteer stuff, like writing these documents.
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ