Red Hat Linux 9 Professional Secrets [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Red Hat Linux 9 Professional Secrets [Electronic resources] - نسخه متنی

Naba Barkakati

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








Setting up a Graphical Login


Setting up your Linux workstation to display a graphical login screen is easy—all you have to do is make the appropriate selection during the installation. Even if you have not initially elected to have a graphical login screen, you can easily set it up once you know the details. The following sections explain how your Red Hat Linux system displays the graphical login screen.


Understanding How init Starts the Display Manager


A process named init starts the initial set of processes on your Red Hat Linux system. What

init starts depends on the current run level, the contents of the

/etc/inittab file, and the shell scripts located in the

/etc/rc.d directory and its subdirectories. For now, you don’t need to understand the details; you must know, however, that the graphical login screen starts at run level 5.






Cross Ref

Chapter 20 describes in detail the init process, the

/etc/inittab file, and the Red Hat Linux boot process.


The last line of the

/etc/inittab file is responsible for starting the graphical login process with the following entry (the number 5 denotes run level 5):

x:5:respawn:/etc/X11/prefdm -nodaemon

This command runs

/etc/X11/prefdm , a shell script that contains the following lines:

#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
# Shut down any graphical boot that might exist.
if [ -x /usr/bin/rhgb-client ]; then
/usr/bin/rhgb-client -quit
fi

# We need to source this so that the login screens are translated.
[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh
# Run preferred X display manager
# Try autologin first, if wanted...
if [ -f /etc/sysconfig/autologin -a -x /usr/sbin/autologin ]; then
if /usr/sbin/autologin; then
exit 0
fi
# If autologin fails (bad permissions, etc.), we get here -
# time to start a real display manager.
fi
preferred=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
if [ "$DISPLAYMANAGER" = GNOME ]; then
preferred=gdm
elif [ "$DISPLAYMANAGER" = KDE ]; then
preferred=kdm
elif [ "$DISPLAYMANAGER" = XDM ]; then
preferred=xdm
fi
fi
if [ -z "$preferred" ]; then
if which gdm >/dev/null 2>&1; then
preferred=gdm
elif which kdm >/dev/null 2>&1; then
preferred=kdm
elif which xdm >/dev/null 2>&1; then
preferred=xdm
fi
fi
if [ -n "$preferred" ] && which $preferred >/dev/null 2>&1; then
exec `which $preferred` $* >/dev/null 2>&1
fi
if which gdm >/dev/null 2>&1; then
exec `which gdm` $* >/dev/null 2>&1
elif which kdm >/dev/null 2>&1; then
exec `which kdm` $* >/dev/null 2>&1
elif which xdm >/dev/null 2>&1; then
exec `which xdm` $* >/dev/null 2>&1
fi
# Catch all exit error
exit 1

This script starts a specific display manager—gdm, kdm, or xdm—depending on the setting of the

DISPLAYMANAGER variable in the

/etc/sysconfig/desktop file. The display manager is a program responsible for displaying the graphical login window, authenticating users who log in, running initialization scripts at the start of a session, and cleaning up after the session. The display manager process manages the display, making it available to the users and cleaning up after the user finishes a session. Note that of the three display managers—gdm, kdm, or xdm—xdm is the most generic.








Secret


If the

DISPLAYMANAGER variable is not defined, the

/etc/X11/prefdm script checks for

gdm ,

kdm , and

xdm —in that order—and runs whichever display manager it finds first. The end result is that you get

gdm if you installed GNOME and

kdm if you installed KDE as your sole desktop. If you install both GNOME and KDE, you get

gdm by default because the

prefdm script looks for

gdm first. If you do have both GNOME and KDE installed on your system and you want the

kdm as the display manager, define the

DISPLAYMANAGER variable in

/etc/sysconfig/desktop like this:

DISPLAYMANAGER="KDE"

Then, the next time you reboot the system, the kdm display manager will run.

To summarize, regardless of your choice of GUI, at run level 5 init starts a display manager. The display manager, in turn, displays the graphical login dialog box, which enables you to log in to the system.











If you have not enabled the graphical login screen during Red Hat installation, you can do so by editing the

/etc/inittab file. Locate the line containing

initdefault , and make sure that it reads as follows:

id:5:initdefault:





Caution

Before you edit the

/etc/inittab file, you should know that any errors in this file may prevent Linux from starting up to a point at which you can log in. If you cannot log in, you cannot use your system.


After editing the default run level in

/etc/inittab , you can either reboot the system or type the following command to switch to run level 5:

telinit 5


Learning the GNOME Display Manager (gdm)


The gdm program is a display manager similar to xdm, the X display manager. Like xdm, gdm starts an X server for each local display, displays a login dialog box, and enables the user to log in to the system. Figure 9-1 shows a typical graphical login screen displayed by gdm.


Figure 9-1: Graphical Login Screen Managed by gdm.

When gdm runs, it reads various configuration parameters from the configuration file

/etc/X11/gdm/gdm.conf , which has a structure similar to a Windows

INI file. For example, here is a typical

gdm.conf file:

[daemon]
AlwaysRestartServer=false
AutomaticLogin=
AutomaticLoginEnable=false
Chooser=/usr/bin/gdmchooser
Configurator=/usr/sbin/gdmsetup --disable-sound --disable-crash-dialog
DefaultPath=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin
DisplayInitDir=/etc/X11/gdm/Init
FailsafeXServer=
FirstVT=7
FlexibleXServers=5
GnomeDefaultSession=/usr/share/gnome/default.session
Greeter=/usr/bin/gdmgreeter
Group=gdm
HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shutdown -h now
KillInitClients=true
LocalNoPasswordUsers=
LogDir=/var/log/gdm
PidFile=/var/run/gdm.pid
PostSessionScriptDir=/etc/X11/gdm/PostSession/
PreSessionScriptDir=/etc/X11/gdm/PreSession/
RebootCommand=/sbin/shutdown -r now;/usr/sbin/shutdown -r now
RemoteGreeter=/usr/bin/gdmlogin
RootPath=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
ServAuthDir=/var/gdm
SessionDir=/etc/X11/gdm/Sessions/
StandardXServer=/usr/X11R6/bin/X
SuspendCommand=
TimedLogin=
TimedLoginDelay=30
TimedLoginEnable=false
User=gdm
UserAuthDir=
UserAuthFBDir=/tmp
UserAuthFile=.Xauthority
VTAllocation=true
XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing
Xnest=/usr/X11R6/bin/Xnest -name Xnest
[security]
AllowRemoteAutoLogin=false
AllowRemoteRoot=true
AllowRoot=true
RelaxPermissions=0
RetryDelay=1
SessionMaxFile=524388
UserMaxFile=65536
[xdmcp]
DisplaysPerHost=1
Enable=false
HonorIndirect=true
MaxPending=4
MaxPendingIndirect=4
MaxSessions=16
MaxWait=15
MaxWaitIndirect=15
Port=177
Willing=/etc/X11/gdm/Xwilling
[gui]
GtkRC=/usr/share/themes/Bluecurve/gtk-2.0/gtkrc
MaxIconHeight=128
MaxIconWidth=128
[greeter]
BackgroundColor=#27408b
BackgroundImage=
BackgroundProgram=
BackgroundRemoteOnlyColor=true
BackgroundScaleToFit=true
BackgroundType=0
Browser=false
ConfigAvailable=false
DefaultFace=/usr/share/pixmaps/nobody.png
Exclude= bin,daemon,adm,lp,sync,shutdown,halt,mail,news,uucp,operator,nobody,gdm,postgres,pvm,rpm
GlobalFaceDir=/usr/share/faces/
GraphicalTheme=Bluecurve
GraphicalThemeDir=/usr/share/gdm/themes/
Icon=/usr/share/pixmaps/gdm.png
LocaleFile=/etc/X11/gdm/locale.alias
LockPosition=true
Logo=
MinimalUID=500
PositionX=0
PositionY=0
Quiver=true
RunBackgroundProgramAlways=false
SetPosition=false
ShowGnomeChooserSession=false
ShowGnomeFailsafeSession=false
ShowXtermFailsafeSession=false
SystemMenu=true
TitleBar=false
Use24Clock=false
UseCirclesInEntry=false
Welcome=Welcome to %n
XineramaScreen=0
[chooser]
Broadcast=true
DefaultHostImg=/usr/share/pixmaps/nohost.png
HostImageDir=/usr/share/hosts/
Hosts=
ScanTime=3
[debug]
Enable=false
[servers]
0=Standard
[server-Standard]
command=/usr/X11R6/bin/X
flexible=true
name=Standard server

The

[servers] section of the file specifies the displays on which gdm displays the login dialog box. Each line of this section starts with a display number and shows the command needed to start the X server.

You see the term

greeter used often in the display manager configuration file. Greeter refers to the login screen—the user interface through which the display manager prompts the user to log in to the system.

The different sections in the configuration file control different aspects of the graphical login screen as well as the tasks the user can perform from that screen. Table 9-1 describes the gdm configuration options, organized by sections.






Insider Insight

Edit the

Welcome= line to change the welcome message on the graphical login screen. The default message says welcome to the hostname, which can be somewhat cryptic. You can edit that line and change the message to something more meaningful with the syntax

Welcome=Welcome to XYZ Corp .








































































































































































































































































































































Table 9-1: The gdm Configuration Options


Configuration Option


Description


[daemon] section


AlwaysRestartServer=true or false


If set to true, gdm always kills the existing X server and

starts a new one.


AutomaticLoginEnable=true or false


If set to true, automatically log in the user specified in

the

AutomaticLogin option without asking for any password.


AutomaticLogin=username


If a user name is specified and

AutomaticLogin Enable is true, that user is logged without asking for a password.


Chooser=chooserprogram


Full path and name of the

gdmchooser executable file (typically, this should be

/usr/bin/gdmchooser )


Configurator=chooserprogram


Full path and name of the

gdmconfig executable file (typically, this should be

/usr/bin/gdmconfig )


DefaultPath=pathname


Path (names of directories separated by colons) to be used for the user’s session


DisplayInitDir=pathname


Directory containing the initialization scripts (the default is

/etc/X11/gdm/Init )


FailsafeXServer = safex-script


Full path name of script that gdm should run to provide a

failsafe GUI login screen


FirstVT =number


The virtual terminal (VT) number where X should be run (default is 7)


FlexibleXServers =count


Maximum number of X servers to run


GnomeDefaultSession= sessionfile


Full path name of file that gdm should read if there are no user GNOME session files (the default is

/usr/share/gnome/default.session )


Greeter=greeterprogram


Full path and name of the greeter executable file, followed by arguments (typically, this should be

/usr/ bin/gdmlogin )


Group=groupname


Group name under which

gdmlogin and

gdmchooser are run (the default is

gdm )


HaltCommand=haltprogram


Full path and arguments to the commands to be executed when the user selects Halt from the System menu (typically, this should be

/sbin/shutdown -h now )


KillInitClients=true or false


When set to true, gdm kills the X clients started by the

Init scripts after the user logs in (the default is true).


LocalNoPasswordUsers = userlist


Comma-separated list of users that are allowed to log in without password


LogDir=pathname


Directory containing the log files for the displays (the default is

/var/log/gdm )


PidFile=pidfile


Name of the file where the process ID (pid) of the gdm process is stored (the default is

/var/run/gdm.pid )


PostSessionScriptDir=pathname


Directory that contains the PostSession scripts—scripts run after the user logs out (the default is

/etc/X11/gdm/ PostSession/ )


PreSessionScriptDir=pathname


Directory that contains the

PreSession scripts—scripts run right after the user logs in (the default is

/etc/X11/ gdm/PreSession/ )


RebootCommand=rebootprogram


Full path and arguments to the command to be executed when the user selects Reboot from the System menu (typically, this should be

/sbin/shutdown -r now )


RemoteGreeter =pathname


Full path name of the greeter executable file for remote displays


RootPath=pathname


Path (names of directories separated by colons) to be used for the

root user’s session


ServAuthDir=pathname


Directory (the default is

/var/gdm ) containing the X authentication files for the displays (this directory should be owned by user

gdm , group

gdm , with permission 750)


SessionDir=pathname


Directory containing scripts for all session types available on the system (the default is

/etc/X11/gdm/Sessions )


StandardXServer =pathname


Path name of standard X server (the default is

/usr/X11R6/bin/X )


TimedLogin=username


If a user name is specified and

TimedLoginEnable is true, then that user is logged without asking for any password after the login screen is inactive for the number of seconds specified in the

TimedLoginDelay option


TimedLoginDelay=N


The number of seconds delay before the user specified in

TimedLogin is automatically logged in


TimedLoginEnable=true or false


If set to true, automatically logs in the user specified in the

TimedLogin option without asking for any password


User=username


User name under which

gdmchooser and

gdmlogin are run (the default is

gdm )


UserAuthDir=pathname


Directory where the user’s

.Xauthority file should be saved (if this field is empty, the user’s home directory is used, which is the default)


UserAuthFBDir=pathname


Directory where a fallback cookie (which simply refers to the small amount of authentication information) is created if gdm fails to update the user’s

.Xauthority file (the default is

/tmp )


UserAuthFile=filename


Name of the file for storing the user’s authentication cookies (the default is

.Xauthority )


VTAllocation =true or false


If true, automatically allocate virtual terminal (VT) for use by X server (default is

true )


XKeepsCrashing=sessionfile


Full path name of a script that gdm should run if X keeps crashing (the default script is

/etc/X11/gdm/ XKeepsCrashing )


Xnest = pathname


Full path name of the nested X server (

Xnest ) that runs as an X client, but also manages graphics on behalf of the X server (default is

/usr/X11R6/bin/Xnest -name Xnest )


[security] section


AllowRemoteAutoLogin =true or false


When set to true, allows remote timed login (the default is

false )


AllowRemoteRoot=true or false


When set to true, the root user can log in remotely (the

default is

true )


AllowRoot=true or false


When set to true, the root user can log in at the console (the default is

true )


RelaxPermissions=0, 1, or 2


0 =

gdm only accepts files and directories owned by the user; 1 =

gdm allows group writeable files and directories; 2 =

gdm allows world writeable files and directories (the default is

1 )


RetryDelay=N


Number of seconds to wait before gdm displays the login window again after a failed login (the default is 3 seconds)


UserMaxFile=N


Maximum size (in bytes) of files that gdm will read or write (the default is 64KB, or 65,536 bytes)


[xdmcp] section


DisplaysPerHost =number


Number of displays per host (the default is

1 )


Enable=true or false


When set to true,

gdm listens on port 177 and supports the X Display Manager Control Protocol (XDMCP) that enables users to log in to other hosts on the network (the default is

false )


HonorIndirect=true or false


When set to true, gdm allows remote execution of the

gdmchooser client on X terminals (the default is

true )


MaxPending=N


Maximum number of pending connections (the default is

4 ) that gdm should allow (this helps avoid any denial of service attacks)


MaxPendingIndirect=N


Maximum number of

gdmchooser clients that

gdm will run simultaneously on remote displays (the default is

4 )


MaxSessions=N


Maximum number of remote display connections that gdm will accept (the default is

16 )


MaxWait=N


Maximum number of seconds that gdm waits for a response from a display before assuming that the display is not active anymore (the default is 15 seconds)


MaxWaitIndirect=N


Maximum number of seconds that gdm waits for a remote display to complete protocol negotiations after the display requests a chooser (the default is 15 seconds)


Port=177


The UDP port number where gdm listens for XDMCP requests (the default is

177 )


Willing =pathname


Full path name of script to run to generate replies to XDMCP BroadcastQuery requests (the default is

/etc/X11/gdm/Xwilling )


[gui] section


GtkRC=pathname


Path name of file that contains the theme to be used by the

gdmlogin and

gdmchooser programs (the default is the BlueCurve theme, defined in the file

/usr/ share/themes/Bluecurve/gtk-2.0/gtkrc )


MaxIconWidth=N


Maximum width (the default is 128 pixels) of icons that the face browser will display (gdmlogin can display a face browser containing icons for all the users on a system; these icons can be installed globally by the system administrator or in the users’ home directories)


MaxIconHeight=N


Maximum height (the default is 128 pixels) of icons that the face browser will display


[greeter] section


BackgroundColor =#colornum


Background color


BackgroundImage =pathname


Pathname of image to use as background (when

BackgroundType =1)


BackgroundProgram =pathname


Pathname of program to run to draw the background


BackgroundRemoteOnlyColor = true or false


When set to

true , displays a solid color background for remote displays (the default is

true )


BackgroundScaleToFit = true or false


When set to

true , scales image to fit screen (the default is

true )


BackgroundType =0, 1, or 2


Type of background for the greeter,

0 = None,

1 = Image,

2 = Color (the default is 0)


Browser=true or false


When set to

true , displays a browser, called the face browser, where the faces of all system users are displayed (the default is

false )


ConfigAvailable =true or false


When set to

true , configuration option is available from the System menu (default is

false )


DefaultFace=imagefile


A file, readable by the

gdm user, containing an image that is to be displayed if a user does not have a personal picture in the

~/gnome/photo directory (which refers to the

gnome/photo subdirectory of the user’s home directory). The default is the

/usr/share/pixmaps/ nobody.png file.


Exclude=usernames


Comma-separated list of user names to be excluded from the face browser; the excluded users will still be able to log in


GlobalFaceDir=pathname


Directory where face files (each containing an icon showing a user’s face) are located (the default is

/usr/share/faces/ )


GraphicalTheme =themename


Name of graphical theme to use (default is

BlueCurve )


GraphicalThemeDir =pathname


Directory where graphical theme files are located (the default is

/usr/share/gdm/themes/ )


Icon=imagefile


A file, readable by the

gdm user, containing the image to be displayed when the login window is in iconified state (the default is

/usr/share/pixmaps/gdm.xpm )


LocaleFile=localefile


Full pathname for the file in GNU locale format, with entries for all languages supported on the system (the default is

/etc/X11/gdm/locale.alias )


LockPosition =true or false


When set to

true , the user cannot move the greeter window (the default is

true )


Logo=imagefile


A file, readable by the

gdm user, with the image to be displayed in the logo area (the default is

/usr/share/ pixmaps/gnome-logo-large.png ).


MinimalUID =number


Users with this user ID or higher can log in (the default is 500)


PositionX =xpos


Horizontal and vertical position of greeter window

PositionY=ypos


Quiver=true or false


When set to

true , the gdmlogin program shakes the display (not physically, but by moving the graphics output) when a user enters an incorrect password (the default is false)


RunBackgroundProgramAlways = true or false


When set to

true , runs the background program specified by

BackgroundProgram (the default is

false )


SetPosition =true or false


When set to

true , the gdmlogin program shakes the display (not physically, but by moving the graphics output) when a user enters an incorrect password (the default is

false )


ShowGnomeChooserSession = true or false


When set to

true , shows previous GNOME sessions in the chooser (the default is

false )


ShowGnomeFailsafeSession = true or false


When set to

true , shows the GNOME failsafe session in the chooser (the default is

false )


ShowXtermFailsafeSession = true or false


When set to

true , show the failsafe session that runs an xterm window (the default is

false )


SystemMenu =true or false


When set to

true , show the System menu on the greeter (the default is

true )


TitleBar =true or false


When set to true, show a title bar on the greeter window (the default is

false )


Use24Clock =true or false


When set to

true , use a 24-hour clock no matter what the locale (the default is

false )


UseCirclesInEntry =true or false


When set to

true , echo the typed password as circles

(the default is

false )


Welcome=message


The English welcome message that the

gdmlogin program displays next to the logo on the login screen (the default message is

Welcome to %n , where

%n means the node name—the hostname without the domain)


XineramaScreen =number


The Xinerama screen where greeter is displayed (default is

0 )


[chooser] section


Broadcast =true or false


When set to

true , an XDMCP query is broadcast to get the names of all the hosts that accept login (the default is

true )


DefaultHostImg=filename


File containing an image to be displayed for those hosts that do not have a unique icon file (the default is

/usr/ share/pixmaps/nohost.png )


HostImageDir=pathname


Directory (the default is

/usr/share/hosts/ ) that contains host icon files; each filename matches the host system’s fully qualified domain name (such as

yourhost.yourdomain.com ).


Hosts=hostnames


Comma-separated names of hosts to list


ScanTime=N


Number of seconds the chooser should wait for replies to its XDMCP broadcast query (the default is 3 seconds)


[debug] section


Enable=true or false


When set to true, gdm saves information that can help isolate any bugs in gdm (the default is

false )


[servers] section


N=ServerName


Name of the X server to start on local display number N (if your system has a single monitor, N is 0). Default is Standard


[server-Standard] section


command=ServerPathName


Full pathname of the Standard X server (the default is

/usr/X11R6/bin/X )


flexible=true or false


When set to

true , the Standard server is considered a flexible server (the default is

true )


name=servername


A descriptive name of the Standard server (default is Standard server)









Secret


For the default configuration (after you install Red Hat Linux and X from the companion CD-ROMs), gdm manages the login session as follows:



  1. The gdm program starts the X server and looks for a script named after the local display’s name (for the first display, the filename is

    :0 ) in the

    /etc/X11/gdm/ Init directory. If it does not find that file, gdm executes the file named

    Default from that directory. The

    /etc/X11/gdm/Init/Default script in Red Hat Linux contains the following commands:

        #!/bin/sh
    # Xsetup for Red Hat Linux
    # Copyright (c) 1999, 2000, 2001 Red Hat, Inc.
    sysresources=/etc/X11/Xresources
    # merge in defaults
    if [ -f "$sysresources" ]; then
    xrdb -merge "$sysresources"
    fi
    /usr/X11R6/bin/xsetroot -solid "#5477A0"
    if [ -z "$RUNNING_UNDER_GDM" ] ; then
    /sbin/pidof -s kdm &> /dev/null && [ $? -eq 0 -a -x /usr/bin/kdmdesktop ] && /usr/bin/kdmdesktop && sleep 1s
    # Only set the background if the xsri program is installed.
    if [ -x /usr/bin/xsri -a -f /etc/X11/xsrirc ]; then
    /usr/bin/xsri --redhat-login --set
    fi
    fi

    In this case, the script sets the background to a solid color and displays the Red Hat logo. The gdm program runs this script as

    root and waits until the commands finish.



  2. The gdm program runs the

    /usr/bin/gdmlogin program, which displays a dialog box that contains fields in which the user can enter a name and a password.



  3. After a user enters a name and password and presses Enter, gdm verifies the password and tries to execute the startup script

    /etc/X11/gdm/PreSession/ DisplayName , where

    DisplayName is

    :0 for the first display. If that file is not found,

    gdm executes the

    /etc/X11/gdm/PreSession/Default script, if it exists.



  4. The gdm program runs the session script from the

    /etc/X11/gdm/Sessions directory. The exact script that gdm runs depends on the session the user selects in the Sessions menu in the login dialog box

    gdmlogin is displayed. If the user has not explicitly selected a specific type of session (GNOME or KDE), gdm runs the

    /etc/X11/gdm/Default script, which, in turn, executes the

    /etc/ X11/xdm/Xsession script. This script looks for another script file, named

    .xsession , in the user’s home directory and executes that script, if it exists. Next, it looks for the

    .Xclients script file in the user’s home directory and executes that file, if it exists. Otherwise,

    Xsession executes the

    /etc/X11/ xinit/Xclients script. When you follow through these scripts, you find that the

    Xclients script executes the

    /usr/bin/gnome-session program if the

    /etc/sysconfig/desktop file contains the line

    DESKTOP="GNOME" . The gnome-session program then starts the GNOME session (which includes a set of applications and a window manager). Initially, gnome-session uses the session file

    /usr/share/gnome/default.session (a text file) to start the applications and the window manager. Later, the GNOME session is restored to the values saved in a file in the

    ~/.metacity/sessions directory (this refers to a subdirectory in the user’s home directory). The default session file runs a script named

    /usr/bin/gnome-wm , which, in turn, starts an appropriate window manager. The default window manager is

    metacity , but you can specify a different window manager by defining the

    WINDOW_MANAGER environment value to the name of a window manager you want.



  5. From this point on, the user can interact with the system through the X display and through the window manager (started by the gnome-session program).



  6. When the user ends the GNOME session (by selecting Log out from the Main Menu button), gdm attempts to run the script

    /etc/X11/gdm/PostSession/ DisplayName , where

    DisplayName is

    :0 for the first display. If that file does not exist, gdm executes the

    /etc/X11/gdm/PostSession/Default script, if it exists.

    Although this brief description of gdm does not show you all the details, gdm provides a user-friendly interface for user login and for starting a GNOME session. Moreover, like many other X programs, gdm is highly configurable. For example, the names of the script files in the preceding list are the typical ones, but you can specify other names through the file named

    gdm.conf , which, by default, also resides in the

    /etc/X11/gdm directory.














Switching from GNOME to KDE


GNOME and KDE are both capable GUI environments. Red Hat Linux comes with both of these GUIs, but you get GNOME as the default GUI. However, Red Hat also includes the utility script

/usr/bin/switchdesk , which enables you easily to switch from one GUI to another, and vice versa. To switch from GNOME to KDE, follow these steps:



  1. From your GNOME desktop, select Main Menu>System Settings>More System Settings>Desktop Switching Tool, or type switchdesk in a terminal window. The Desktop Switcher dialog box appears.



  2. In the Desktop Switcher dialog box, click the KDE radio button to select it (see Figure 9-2), then click the OK button.


    Figure 9-2: Switching to KDE by Using the Desktop Switching Tool.



  3. A message informs you that the desktop configuration has been changed, but you must restart X for the change to take effect. Click the OK button to dismiss the dialog box.



Although the message in Step 3 states that you must restart X, all you need to do is log out of the session and log back in. To log out, select Main Menu>Log Out. When you log in again, you should get the KDE GUI.

The

switchdesk utility changes the GUI by creating the appropriate scripts in your home directory. It leaves the display manager unchanged. This means that you use the GNOME display manager, gdm, for login, even when you switch to the KDE GUI. After you log in, gdm executes a session script that eventually executes the

.Xclients script in your home directory, if that script exists.

When you run the switchdesk utility, you execute a shell script in the

/usr/bin/ switchdesk file that contains the following lines:

#!/bin/sh
echo "Red Hat Linux `basename $0` 3.9"
echo "Copyright (C) 1999-2001 Red Hat, Inc"
echo "Redistributable under the terms of the GNU General Public License"
kicker=`/sbin/pidof "kdeinit: kicker"`
[ -z "$kicker" ] && kicker=`/sbin/pidof kicker`
[ -z "$kicker" ] && kicker=`/sbin/pidof kpanel`
[ -z "$kicker" ] && kicker=`/sbin/pidof kpanel1`
good=1
if [ "$DISPLAY" != " -a "$1" = " ]; then
if [ -n "$kicker" -a -x /usr/bin/switchdesk-kde ]; then
exec switchdesk-kde
elif [ -x /usr/bin/switchdesk-gnome ]; then
exec switchdesk-gnome
elif [ -x /usr/bin/switchdesk-kde ]; then
exec switchdesk-kde
else
echo "Desktop Switcher GUI unavailable."
echo "Please install the switchdesk-kde or switchdesk-gnome packages or use"
echo "switchdesk desktopname."
good=0;
fi
else
good=0;
fi
if [ "$good" = "0" ]; then
exec switchdesk-helper $1
fi








Secret


If you are using GNOME, the

switchdesk script runs the switchdesk-gnome application that displays the GUI from which you change the desktop. In KDE, this script runs the switchdesk-kde GUI tool. The switchdesk-gnome GUI tool creates two scripts—

.Xclients and

.Xclients-default —in the home directory of the user. The

.Xclients script contains the following lines:

#!/bin/bash
# Created by Red Hat Desktop Switcher
if [ -e "$HOME/.Xclients-$HOSTNAME$DISPLAY" ]; then
exec $HOME/.Xclients-$HOSTNAME$DISPLAY
else
exec $HOME/.Xclients-default
fi

The

.Xclients-default script is simpler; it contains the following commands:

# Created by Red Hat Desktop Switcher
exec startkde

The result of these changes is that when you log in the next time, gdm executes the

.Xclients script in your home directory, which, in turn, executes the startkde program (

/usr/bin/startkde ) to start a KDE session.

Because the switchdesk utility changes the GUI by creating the

.Xclients and

.Xclients-default scripts in a user’s home directory, these changes only affect that particular user.











To switch from KDE to GNOME, log in as

root , open a terminal window, and type switchdesk at the shell prompt, then select GNOME as the desktop. After you log out of KDE and log back in, you should get GNOME as your desktop.

Note that if you want to use GNOME for one session only (as opposed to making it your default GUI), simply click Session at the bottom of the login screen, and then select Gnome from the login window menu in the initial login screen, as shown in Figure 9-3.


Figure 9-3: Switching to GNOME for the Current Session Only.

You should get the GNOME desktop for this session. The next time you log in, the system reverts to KDE.


Learning the KDE Display Manager (kdm)


If you install only the KDE desktop or set the

DISPLAYMANAGER variable in the

/etc/ sysconfig/desktop file to

KDE , the kdm program starts the X server for the local display and displays the graphical login window through which you log in to the system. Figure 9-4 shows the graphical login screen that you see when you run the kdm display manager.

When kdm runs, it reads various configuration parameters from the configuration file

/usr/share/config/kdm/kdmrc , which has a structure similar to a Windows

INI file. For example, here is a typical

kdmrc file:

# KDM configuration example.
[General]
Xservers=/usr/share/config/kdm/Xservers
PidFile=/var/run/kdm.pid
[Xdmcp]
Enable=false
Xaccess=/usr/share/config/kdm/Xaccess
Willing=/usr/share/config/kdm/Xwilling
[Shutdown]
HaltCmd=/sbin/poweroff
[X-*-Core]
# Core config for all displays
Setup=/usr/share/config/kdm/Xsetup
Startup=/usr/share/config/kdm/Xstartup
Reset=/usr/share/config/kdm/Xreset
Session=/usr/share/config/kdm/Xsession
AutoReLogin=false
AllowRootLogin=true
AllowNullPasswd=true
AllowShutdown=Root
[X-*-Greeter]
# Greeter config for all displays
SessionTypes=default,kde,failsafe,gnome
GUIStyle=Bluecurve
LogoArea=Clock
GreetFont=Sans,12,-1,5,75,0,0,0,0,0
StdFont=Sans,10,-1,5,50,0,0,0,0,0
FailFont=Sans,10,-1,5,75,0,0,0,0,0
AntiAliasing=true
ShowUsers=None
MinShowUID=500
SortUsers=true
PreselectUser=None
FocusPasswd=false
EchoMode=OneStar
[X-:*-Core]
# Core configurations for local displays
# place local display core configurations here
[X-:*-Greeter]
# Greeter configurations for local displays
# place local display greeter configurations here


Figure 9-4: Graphical Login Screen Managed by kdm.


As you can see, the file is organized into sections, with each section identified by labels within square brackets. Each section specifies a related set of options that affects some aspect of the GUI login process.








Secret


You can configure the look and feel of the kdm greeter—the login dialog box—on each X display individually. The configuration of each display is specified by a section name that has the following format:

[X-host:number_class-subsection]

where

host refers to the hostname of the system to which the display is attached (can be empty for a local display),

number is the display number (

0 , if you have only one display),

class is a display class (it’s optional and ignored in most cases), and

subsection identifies the element of the display manager to which the options apply. For example, if the options apply to the desktop, subsection is

Desktop . If the options are for the greeter, the subsection is

Greeter . You can use an asterisk (

* ) for any of these elements—host, number, and class—as a wildcard.

Thus, to specify the options for the greeter for all displays, place the options in a section named

[X-*-Greeter] . To change some of these greeter options for the local displays, place the changed options in the

[X-:*-Greeter] section. On the other hand, if you want to customize some aspect of the greeter for the first local display (which is display number

0 ), place those options in the section labeled

[X-:0-Greeter] .











Table 9-2 summarizes some common

kdm configuration options, organized by sections. I show the X display options for all displays. To customize these for a specific display, you can add a section with a name that reflects the X display to which the options apply.





























































































































































































Table 9-2: Common kdm Configuration Options


Configuration Option


Description


[General] section


LockPidFile=true or false


If set to true, kdm locks the

PidFile to prevent multiple instances of kdm from running simultaneously


PidFile=/var/run/kdm.pid


File where kdm should store its process ID (ID)


Xservers= /usr/share/config/kdm/Xservers


File containing list of X servers to start (one per display)



[Xdmcp] section


ChoiceTimeout=seconds


Number of seconds to wait for display to respond after the user has selected a host from the chooser (default is 15 seconds)


Enable=true or false


If set to

true , kdm listens on port 177 and supports the X Display Manager Control Protocol (XDMCP) that enables users to log in to other hosts on the network (the default is

true )


Port=177


The UDP port number where kdm listens for XDMCP requests (default is

177 )


RemoveDomainname=true or false


If set to true, strips domain name from remote display names if it is equal to the local domain (default is

true )


SourceAddress=true or false


Use the numeric IP address of the incoming connection instead of the hostname (useful on multihomed hosts, the default is

false )


Willing= /usr/share/config/kdm/Xwilling


Program to run to generate replies to XDMCP BroadcastQuery requests (the Xwilling program is a shell script that displays the number of users and current load average)


[Shutdown] section


HaltCmd=/sbin/poweroff


Full pathname of command to run to halt the system


RebootCmd=/sbin/reboot


Full pathname of command to run to reboot the system (default is /

sbin/reboot )


[X-*-Core] section (core configuration for all displays)


AllowNullPasswd=true or false


If set to

true ,

kdm allows users with empty passwords to log in (default is

true )


AllowRootLogin=true or false


If set to true, kdm allows logins by

root (default is

true )


AllowSdForceNow=Root or All


Specifies who can abort all currently running programs when shutting down system; choices are

All for anyone or

Root for

root user (default is

All )


AllowShutdown=Root or All


Specifies who can shut down the system; possible values are

All to enable anyone to shut down the system,

None to prevent shutdown from the login screen, and

Root to require

root password for shutdown (default is

All )


AutoReLogin=true or false


If set to true, kdm will automatically restart a session after the X server crashes or if it is killed by pressing Ctrl-Alt-Backspace (default is

false )


DefaultSdMode=ForceNow or ForceNow

TryNow or Schedule


The default mode for shutdown; choices are to shut down immediately,

Schedule to shut down after the session exits, or

TryNow to shutdown if no session is open and do nothing otherwise (default is

Schedule )


OpenDelay=seconds


Number of seconds to wait before retrying to open the display after any error (default is 15 seconds)


OpenRepeat=seconds


How many seconds to wait before trying to open display again (default is 5 seconds)


OpenTimeout=seconds


Number of seconds to wait before timing out on the attempt to open the display (default is 120 seconds)


PingInterval=seconds


How many minutes between successive pinging of remote displays (ping checks if network connection is up and running; default interval is 5 minutes)


Reset= /usr/share/config/


Program to run after a user session ends

kdm/Xreset


ResetSignal=1


The signal to send to reset the local X server (default is

1 , which stands for SIGHUP)


Session= /usr/share/config/kdm/Xsession


Program that accepts the

SessionTypes argument and starts an appropriate session


SessSaveFile=.wmrc


Filename (in user’s home directory) where the last session type is stored (default is

.wmrc )


Setup= usr/share/config/


Program to run before showing the greeter window

kdm/Xsetup


StartAttempts=number


The maximum number of times to try opening a display before the display is disabled (default is

4 )


StartInterval=seconds


How many seconds to wait before resetting the

StartAttempts counter (default is 30 seconds)


Startup= usr/share/config/


Program to run before starting a user session

kdm/Xstartup


TerminateServer=true or false


If set to true, restart the local X server instead of resetting after session ends (default is false)


TermSignal=signum


The signal to send to terminate the local X server (default is 15, which stands for SIGTERM)


[X-*-Greeter] section (greeter configuration for all displays)


AntiAliasing=true or false


If set to true, fonts shown in the greeter should be antialiased (default is

false )


DefaultUser=username


User preselected for login if

PreselectUser =

Default


EchoMode=OneStar or ThreeStar or NoEcho


What to show as user types the password; choices are

NoEcho to show nothing at all,

OneStar to show a

* for each letter typed, or

ThreeStars to show

*** for each letter typed (default is

OneStar )


FailFont= Sans,10,-1,5,75,


Font used for the “Login Failed” message

0,0,0,0,0


FocusPasswd=true or false


If set to true, the password input line is automatically selected to receive the keyboard input (default is

false )


GreeterPosFixed=true or false


If set to

true , the position of the greeter window is fixed and specified by

GreeterPosX and

GreeterPosY (default is

false )


GreeterPosX=pixels


Horizontal position, in pixels, of greeter window


GreeterPosY=pixels


Vertical position, in pixels, of greeter window


GreetFont=Sans,12,-1,5,75,


The font to use for the welcome text

0,0,0,0,0


GreetString= welcometext


Welcome text in greeter window (default is

"Welcome to %s at %n" ); use following special characters strings:

%d = current display

%h = hostname, possibly with domain name

%n = node name, most probably the hostname without domain name

%s = operating system (

Linux )

%r = operating system’s version

%m = machine (hardware) type

%% = a single

%


GUIStyle=Bluecurve


The look and feel of the greeter (other choices are

Default ,

Windows ,

Motif ,

CDE , and any other styles installed on the system)


HiddenUsers=user1,user2,...


List of user names not to be listed in the greeter when

ShowUsers is

NotHidden


Language=en_US


Language to use in the greeter (default is

en_US )


LogoArea=Clock


What to show in the area to the right of the text input line (other options are

Logo to display an image specified by

LogoPixmap ,

Clock to display an analog clock, and

None to display nothing)


LogoPixmap= /usr/share/apps/


The image to show when

LogoArea is set to Logo

kdm/pics/kdelogo.png


MinShowUID=500


Users with UID less than the specified number are not shown


NumLock=Off


What to do with the Num Lock key during the time when the greeter is running; choices are

On to turn it on,

Off to turn it off, and

Keep to leave it at its previous state


PreselectUser=None or Previous or Default


User name to be preselected for login; choices are

Previous to preselect the previous user,

Default to select user listed in

DefaultUser field, or

None to not preselect at all (default is

None )


SelectedUsers=user1,user2,...


List of users to show when

ShowUsers =

Selected


SessionTypes= default,kde, failsafe,gnome


Names of session types that the user can select from the GUI login window


ShowUsers=None


Which user names, along with pictures, to show in the greeter; choices are

NotHidden to show all users except those listed in

HiddenUsers , Selected to show only those users listed in

SelectedUsers , and

None to show no users at all (default is

NotHidden )


SortUsers=true or false


If set to

true , sort user names alphabetically (default is

true )


StdFont= Sans,10,-1,5,50,


Normal font used in the greeter

0,0,0,0,0



/ 341