配置XDM--一种Linux的图形登录界面

转自:http://www.hackhome.com/2005/7-14/00414266097.shtml

  本文的最近更新会放在 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 有一种非常好的能力,可以让你选择你想要的工作台环境 。在RedHat 6.0 下,当你登录时可以选择 KDE ,GNOME ,或者其它的工作台环境,这 是非常“酷”的。全面的, 我给 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.
  

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值