Top

A Linux User Reference

Search tips
  • search ignores words that are less than 4 characters in length
  • searches are case insensitve
  • if a search does not return anything try it in Boolean mode then Query expansion mode by checking the appropriate radio button e.g. searching for 'cron' in just the Administration category returns nothing - presumably because the 50% threshold is reached. Boolean mode ignores this threshold so a search for 'cron' returns several hits
  • in Boolean mode preceding a word with a '+' means the result must include that word, a '-' means it must not
  • in Boolean mode '+crontab -anacron' means match articles about crontab that DO NOT mention anacron
  • to match a phrase e.g. 'manage system' check the Boolean mode radio button and enclose the phrase in quotes "some phrase ..."
  • in Query expansion mode the search context is expanded beyond the keywords you entered - relevancy of hits may well be degraded

DESKTOP UIS

Gnome Display Manager

  • GDM overview
    • GDM (Gnome Display Manager) is a replacement for XDM, the X Display Manager.
    • 'gdm' is usually run during boot via '/etc/init.d/gdm'. It checks the file /etc/X11/default-display-manager to see if it is the default display manager - if not it exits.
    • 'gdm' looks for ~/.xsession (~/.xprofile) for user specfic configuration, can run PostLogin, PostSession and PreSession scripts and calls 'xinit' ('startx') to run the X server.

    Default display manager - /etc/X11/default-display-manager

    /usr/sbin/gdm
    
  • GDM init scripts

    Once the X server has started successfully 'gdm' tries to run the first script found from the following list in the following order:

    1. /etc/gdm/Init/ (default - /etc/gdm/Init/:0)
    2. /etc/gdm/Init/
    3. /etc/gdm/Init/XDMCP
    4. /etc/gdm/Init/Flexi

    If none of the above are found, runs '/etc/gdm/Init/Default'. This script runs as root and GDM blocks until it terminates.

  • PostLogin, PreSession and Postsession scripts
    PostLogin

    When the user has been successfully authenticated and BEFORE any session setup 'gdm' tries the scripts in /etc/gdm/PostLogin directory in the same manner as for the Init directory. Might be used to setup the home directory (though pam_mount module should be used).

    The script runs as root - $USER and $DISPLAY environment variables set for this script.

    PreSession

    After the user session has been setup from the GDM side of things 'gdm' tries to run the scripts in the /etc/gdm/PreSession directory in the same manner as the Init directory. Can be used for session management or accounting, for example.

    The base Xsession script is then run with the selected session executable as the first argument. Runs as the user, is basically the user session.

    The available session executables are taken from the 'Exec=' line in the .desktop files in the path specified by 'SessionDesktopDir'. The first found file is used. The user either picks from these sessions or GDM will look inside the file '~/.dmrc' for the stored preference.

    Determine which session is being run

     $ grep SessionDesktopDir gdm.conf
     SessionDesktopDir=/usr/share/gdm/BuiltInSessions/:/usr/share/xsessions/: \
     /var/lib/menu-xdg/xsessions/:/etc/dm/Sessions/
    
     # This is the default .desktop session.  One of the ones in SessionDesktopDir
     DefaultSession=default.desktop
    
     $ grep default /usr/share/gdm/BuiltInSessions/default.desktop
     Exec=default
    
    
    PostSession

    Runs when the user terminates their session. Operation is similar to Init, PostLogin and PreSession. The '/etc/gdm/PostSession' script will be run even when the display fails to respond due to an I/O error or similar.

    Neither of the Init, PostLogin, PreSession or PostSession scripts are necessary and can be left out. The Xsession script is however required as well as at least one session .desktop file

  • Stop and start gdm
    • Comment out entry in /etc/inittab if it exists - dated
    • Disable gdm from start-up either via GUI or by removing start-up script and or link
    # rm /etc/rc3.d/S30gdm              (S30gdm is a symlink -> ../init.d/gdm)
                                        (or)
    # update-rc.d gdm remove
                                        (or)
    # /etc/init.d/gdm stop              (start|restart|reload|force-reload|status)
    

    Have also seen references to 'gdm-stop' and 'gdm-restart' commands though they are only available for versions > 2.20.10.

  • Configuration files and commands

    Configuration, customisation is done either by running 'gdm' or 'gdmsetup' command or by editing files directly. Depending on the version of Gnome two other tools are available to make configuration changes - 'gconftool-2' or' gconf-editor'. The issue here is, not so much the availability of the tools, but whether or not the options are in the configuration system.

    The main configuration file is /etc/gdm/gdm.conf. This should not be edited directly, instead, edit /etc/gdm/gdm.conf-custom which will override values in /etc/gdm/gdm.conf.

    If a configuration option is not defined in either file, GDM will default to the value described in the comments in the GDM System Defaults File. All the configuration files, except the GDM System Defaults file are under /etc/gdm. The System defaults file <share>/gdm/defaults.conf should not be modified by the user.

    $ tree -af /etc/gdm
    /etc/gdm
    |-- /etc/gdm/Init                                (Script directory)
    |   '-- /etc/gdm/Init/Default
    |-- /etc/gdm/PostLogin                           (Script directory)
    |   '-- /etc/gdm/PostLogin/Default.sample
    |-- /etc/gdm/PostSession                         (Script directory)
    |   '-- /etc/gdm/PostSession/Default
    |-- /etc/gdm/PreSession                          (Script directory)
    |   '-- /etc/gdm/PreSession/Default
    |-- /etc/gdm/XKeepsCrashing                      (Script. Runs when the X server keeps crashing)
    |-- /etc/gdm/Xsession                            (Script. Initiates a user's choice of session)
    |-- /etc/gdm/failsafeBlacklist
    |-- /etc/gdm/failsafeDexconf
    |-- /etc/gdm/failsafeXServer
    |-- /etc/gdm/failsafeXinit
    |-- /etc/gdm/gdm.conf                            (Should not be edited)
    |-- /etc/gdm/gdm.conf-custom                     (Edit to customise)
    |-- /etc/gdm/gdmprefetchlist
    |-- /etc/gdm/locale.conf                         (Similar to a locale.alias file, but is not one)
    |-- /etc/gdm/local.alias                         (List of all languages that may be on the system)
    '-- /etc/gdm/modules                             (Configuration of accessibility modules)
        |-- /etc/gdm/modules/AccessDwellMouseEvents
        |-- /etc/gdm/modules/AccessKeyMouseEvents
        |-- /etc/gdm/modules/factory-AccessDwellMouseEvents
        '-- /etc/gdm/modules/factory-AccessKeyMouseEvents
    

    This could be well dated by now.

  • Configuration tools
    /usr/bin/gconftool-2, gconf-editor

    'gconftool-2' is the GNOME command line configuration tool. 'gconf-editor' is the equivalent GUI editor for the GConf configuration system.

    gconftool [options]
    
    Some options:
     -s | --set                                   Set a key to a value and sync. Use with --type.
     -g | --get                                   Print the value of a key to standard output.
     -u | --unset                                 Unset the keys on the command line.
     --recursive-unset                            Recursively unset all keys at or below the 
                                                  key/directory names on the command line.
     -a | --all-entries                           Print all key/value pairs in a directory.
     --all-dirs                                   Print all subdirectories in a directory.
     -R | --recursive-list                        Print all subdirectories and entries under a
                                                  dir, recursively.
     --dir-exists=STRING                          Return 0 if the directory exists, 2 if not exist.
     -t | --type=int|bool|float|string|list|pair  Specify the type of the value being set or the
                                                  type of  the value a schema describes.  Unique
                                                  abbreviations are allowed.
     --list-type=int|bool|float|string            Specify the type of the list value being set or
                                                  the type of the value a schema describes. Unique
                                                  abbreviations are allowed.
    

    Print all entries in the configuration system under /desktop/gnome

    $ gconftool -R /desktop/gnome | head -n 5
     /desktop/gnome/file_views:
      show_hidden_files = false
      tabs_enable = true
      icon_theme = crux_teal
      tabs_open_position = after_current_tab
    

    Get a specific value/setting

    $ gconftool -g /desktop/gnome/interface/icon_theme
    Human
    
  • GDM GUI configurator
    /usr/sbin/gdm, gdmsetup

    The GNOME Display Manager. 'gdmsetup' is the graphical tool version of 'gdm'. It does not support all the options possible so editing the configuration file is sometimes necessary.

    The GDM daemon must be restarted to effect changes made to the configuration file.

    Run the gui

    $ sudo gdmsetup
    [sudo] password for mark:
                                       (or)
    $ /usr/bin/gksu gdmsetup
    
  • Per-display configuration
    • Specified by creating a file named /gdm/custom.conf with the section and keys to use on this display.
    • When changing a value ensure that the [Section label] appears along with and key=value statements in the custom or per-display configuration files.
    • Ensure both the Section label/header and any settings appear in the custom file(s)

    Lable and key=value statements in /etc/gdm/custom.conf

    [daemon]                             # section/label header
    Greeter=/usr/lib/gdmgreeter          # key=value pair
    

    GDM is picky about the file ownership and permissions of the user files it will access - it ignores files if:

    • they are not owned by the user
    • they have group/world write permission

    It will also ignore the user if:

    • the user's $HOME directory is not owned by the user
    • the user's $HOME directory has group/world write permission

    Files must also be smaller than the UserMaxFile value as defined in the GDM configuration. Problems with incorrect use of configuration settings are most like due to one or more of the above checks failing.

  • GDM's kdm .ini style per-user config file
    ~/.dmrc
    • A standard .ini style configuration file.
    • In theory this file should be shared between GDM and KDM.
    • Usually created the first time a user logs in and then whenever the user makes a change to the default values.
    • Has one section - [Desktop] - which has two keys

      1. Session key

        Specifies the basename of the session file (.desktop) the user wishes to normally use (without the .desktop extension).

      2. Language key

        Specifies the language. If either of these keys is missing, the system default is used.

    Example of a 'normal' looking ~/.dmrc file

    [Desktop]
    Session=gnome
    Language=cs_CZ.UTF-8
    
  • Change the login greeting

    In general two settings are required, one to say which greeting to use and the other to specify the greeting. There are Welcome greetings for:

    • attached displays
    • remote displays (XDMCP)
    • default

    The settings control the text displayed next to the logo in the greeter. In the Themed Greeter the location of this text depends on the theme. Unless the theme uses the stock Welcome string somewhere this string will not be displayed at all.

    For a less graphically intensive login screen for XDMCP remote terminals it is better to use 'gdmlogin' than gdmgreeter. This is the default behaviour.

    Default login configuration - /etc/gdm.conf-custom

    .....
    Greeter=/usr/lib/gdm/gdmgreeter
    RemoteGreeter=/usr/lib/gdm/gdmlogin
    

    Supported control characters in the Welcome string

    Characters Output string
    %% The % character
    %d Display's hostname
    %h Fully qualified hostname
    %m Machine (processor type)
    %n Nodename (i.e. hostname without .domain)
    %r Release (OS version)
    %s Sysname (i.e. OS)

    Change DefaultWelcome for attached displays - /etc/gdm/gdm.conf-custom

    [greeter]
    DefaultWelcome=false
    Welcome=Hi there
    

    If 'DefaultWelcome=true', the value of the pre-defined/default/theme "Welcome" is used for the Welcome message. This value is translated into the appropriate language for the user.

    If set to "false", the "Welcome" setting in the [greeter] section is used.

    Change DefaultRemoteWelcome for remote displays - /etc/gdm/gdm.conf-custom

    [greeter]
    DefaultRemoteWelcome=false
    RemoteWelcome=Hi there
    

    If 'DefaultRemoteWelcome=true', the value "Welcome to %n" is used for the RemoteWelcome. This value is translated into the appropriate language for the user.

    If set to "false", the "RemoteWelcome" setting the [greeter] section is used.

    Some other greeter settings

     BackgroundType=2                     # Use BackgroundColor for greeter, also use as
                                          # bckground for transparent images and if the 
                                          # BackgroundRemoteOnlyColor use for remote display
     BackgroundColor=#76848F              # Use this colour in the background of the greeter
     BackgroundImage=somefile.png         # Display image as background image in greeter if
                                          # BackgroundType=1
     PositionX=200                        # Horizontal position of the login window of the 
                                          # GTK+ Greeter
     PositionY=100                        # Vertical position of the login window of the 
                                          # GTK+ Greeter
     SetPosition=true                     # Position of login window is determined by PositionX
                                          # and PositionY 
     Quiver=true                          # Controls whether gdmlogin should shake the display
                                          # when an incorrect username/password is entered
    

    The section heading e.g. [greeter] is required.

  • Change the color depth

    Edit - /etc/gdm.conf-custom

    [daemon]
    [security]
    [xdmcp]
    [gui]
    [greeter]
    [chooser]
    [debug]
    [servers]
    1=myserver
    0=Standard device=/dev/console
    [server-myserver]
    command=/usr/bin/X -br -audit 0 -depth 16 vt9
    flexible=true
    

    Sets up two displays, the first is the standard attached display at :0 the second on vt9 uses 16 bpp.

    'ctrl-alt-f9' switches to 16 bpp screen on virtual terminal vt9.

    See the two displays running

    $ ps -ef | grep X
    root  2996  ..... /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
    root  3411  ..... /usr/bin/X :1 -br -audit 0 -depth 16 vt9 -auth /var/lib/gdm/:1.Xauth -nolisten tcp
    

    NB: 'xorg.conf' needs to have a [Display] SubSection for each colour depth that is to be used.

  • Change Login prompt font

    Example scenario

    On some occasions the text typed into login screen prompt boxes is either very small or very large - out of proportion to the rest of the display.

    In addition the login screen is displayed at the wrong resolution and or depth i.e. as though these settings in xorg.conf are being ignored by the Display Manager.

    To-date this has been due to an incorrectly configured xorg.conf file.

    Driver example

    I have a Radeon graphics card. Running 'X -configure' the driver chosen, configured is Radeon (xserver-xorg-video-radeon). With this driver I get the issues described above.

    The Desktop sizes fine after manually configuring the screen resolution.

    The solution, as stated earlier, is to use the correct driver as opposed to the generic one. In this case the correct or better driver is xorg-driver-fglrx.

    Change driver in /etc/X11/xorg.conf

    Section "Device"
        Indentifier "Card0"
        Driver      "fglrx"
    EndSection
    

    Original Driver chosen by the 'X -configure' command was radeon.

    Alternative to 'X -configure' to generate the xorg.conf

    aticonfig --initial --input=/etc/X11/xorg.conf
    

    If you cannot get hold of the right driver you can still improve things by changing which fonts are used where.

    Identify which greeter theme you are using

    $ grep -o 'GraphicalTheme=.*$' /etc/gdm/gdm.conf
    GraphicalTheme=Human
    

    Non-xdmcp i.e. attached logins use 'gdmgreeter', xdmcp logins i.e. remote logins use 'gdmlogin'

    Theme based control/formatting files are .xml files. For 2.20.10 they are under /usr/share/gdm/themes/<theme>/ and referenced in the *GdmGreeterTheme.desktop file in this directory.

    Identify the gdm greeter theme's .xml file

    $ grep -o 'Greeter=.*$' /usr/share/gdm/themes/Human/GdmGreeterTheme.desktop
    Greeter=Human.xml
    

    Edit the file accordingly

    /usr/share/gdm/themes/Human/Human.xml
    .....
      <!-- password box -->
      <item type="rect">
        <pos x="50%" y="47%" width="box" height="box" anchor="c"/>
           .....
               <item type="entry" id="user-pw-entry">
                 <normal color="#000000" font="Sans 11"/>   <!-- default font size used for 
                                                                 user and password input -->
           .....
    

    Back up the original and the modified files as they will be overwritten on updates.

  • Greeter post 2.20.10
    • the GDM default greeter is called the 'simple Greeter' and can also be configured via 'GConf'.
    • default values are stored in 'GConf' in the gdm-simple-greeter.schemas file. It's values can be edited using the 'gconftool-2' or 'gconf-editor' programs.
    • these defaults can be overridden if the "gdm" user has a writeable $HOME directory to store GConf settings or via /etc/gdm/gdm.custom-conf
  • Banner message text
    gdm-simple-greeter.schemas
    GConf key Value Description
    /apps/gdm/simple-greeter/banner_message_enable false (boolean) Controls whether the banner message text is displayed.
    /apps/gdm/simple-greeter/banner_message_text NULL (string) Specifies the text banner message to show on the greeter window.
  • Custom commands in GDM login screen menu
    • there can be up to 10 custom commands numbered 0-9.
    • these, when defined are added to the GDM menu on the login screen
    • add the command along with a label, text string

    Sample custom commands configured in /etc/gdm/gdm.conf-custom

    [customcommand]
    CustomCommand0=/sbin/rebootwindoze;/usr/local/sbin/rebootwindoze
    CustomCommandLabel0=_Windoze
    CustomCommandLRLabel0=Reboot into _Windoze
    CustomCommandText0=Are you sure you want to restart the computer into Windoze?
    CustomCommandTooltip0=Restarts the computer into Windoze
    CustomCommandIsPersistent0=true
    
    CustomCommand1=/sbin/updatesystem;/usr/local/sbin/updatesystem
    CustomCommandLabel1=_Update Me
    CustomCommandLRLabel1=Update the system
    CustomCommandText1=Are you sure you want to update the system software?
    CustomCommandTooltip1=Updates the system
    CustomCommandNoRestart1=true
    CustomCommand3=/sbin/do_something
    
  • XDMCP securing remote connection
    SSH

    GDM can be configured at compilation-time with the option '--enable-secureremote'. This creates a built-in session called "Secure Remote Connection".

    Such a session allows the user to enter the name or the address of the host on which to connect; provided the said host runs an SSH server, the user then gets connected to the server on which the default X session is started and displayed on the local host.

    GDM guards against DoS (Denial of Service) attacks however each remote connection takes up lots of resources, so it is much easier to DoS via XDMCP then a webserver.

    It is also wise to block all of the application server ports. These are TCP ports 6000 (+ the display number of course). Note that GDM will use display numbers 20 and higher for flexible on-demand servers.

  • XDMCP config examples

    Confgure XDMCP to allow one or more X terminals to connect to one application server.

    • The X Terminals require an X server running on them.
    • The application server will have GDM running on it.

    Unlike XDM, I was unable to find a way for GDM to automatically provide a login-prompt to a remote host(s) without that host having to send an xdmcp query. I could not find a way to convey the foreign display information used by /etc/X11/xdm/Xservers to gdm.conf-custom.

    Example1:

    Enable XDMCP on the application server - /etc/gdm/gdm.conf-custom

    [xdmcp]
    Enable=true
    

    To have no local screens on the application server make the [servers] section, in the same file, empty.

    Start up the Xserver on the X Terminal(s)

    Example2:

    Your X terminal has GDM installed (making it an X station really) and you want a login prompt to the application server. Only one change required on the application server - enabling xdmcp in the same manner as above.

    On the X terminal/station you need to prevent the local GDM from doing anything so the following changes are required:

    Disable XDMCP on the X terminal(s) - /etc/gdm/gdm.conf-custom

    .....
    [xdmcp]
    Enable=false                      # Prevents the X terminal from servicing
                                      # XDMCP queries.
    .....
    [servers]
    0=Terminal -query 192.168.0.3     # Runs a direct query to my xdmcp enabled 
                                      # application server
    
    [server-Terminal]
    name=Terminal server
    command=/usr/bin/X -terminate     # Terminate the Xserver on reset
    flexible=false
    handled=false                     # Do not handle the Xserver locally
    

    To prevent GDM from starting a local Xserver on this client make sure that '0=Standard' is commented out.

  • Provide a choice of application servers at log-on

    This involves running a 'chooser' program. If GDM is installed on the X terminal the chooser can be run locally else it can be run by the application server.

    The chooser program presents users with a list of application servers available on the network. When a selection is made the chooser program forwards a query to the selected application server which responds with a login prompt.

    Run 'chooser' locally on the X terminal (gdm installed) - on the X Terminal in /etc/gdm/gdm.conf.custom

    .....
    [security]
    
    [xdmcp]
    Enable=false                      # Ensure X Terminal's gdm does not respond to xdmcp messages
    
    [greeter]
    
    [chooser]
    
    [debug]
    
    [servers]
    0=localChooser                    # A label pointing to the server section to use for display :0
    
    [servers-localChooser]
    name=localChooser
    command=/usr/bin/X                # Run a standard Xserver
    flexible=false
    chooser=true                      # Run the 'chooser' program
    

    When GDM runs on the X terminal it will display, at the login, a list of available appservers (xdmcp enabled systems).

    The XDMCP chooser will normally send a broadcast query to see which application servers are available on the network. If any application servers are configured to ignore broadcasts they can be added to the chooser list manually via a comma separated list.

    Manually add servers to a local chooser programs list - /etc/gdm/gdm.conf.custom

    .....
    [chooser]
    Hosts=appserver1,appserver2
    

    Run the 'chooser' on the application server, display on the X terminal

    #/etc/gdm/gdm.conf.custom on X the Terminal
    .....
    [security]
    
    [xdmcp]
    Enabled=false
    
    [greeter]
    
    [chooser]
    
    [debug]
    
    [servers]
    0=appChooser -indirect 192.168.0.3         # Run the chooser on 192.168.03
    
    [servers-appChooser]
    name=appChooser
    command=/usr/bin/X -terminate
    flexible=false
    handled=false
    
  • BulletProof-X
    • Provides a failsafe mode which will ensure that users never have to manually configure their graphics hardware settings from the command line.
    • It will launch if the /etc/X11/xorg.conf file does not result in a working graphical environment due to Xorg failing to start.

    Can be invoked manually by:

    1. specifying 'xforcevesa' via grub's kernel cmdline
    2. setting the XORG_FAILSAFE_MODE environment variable to a non-empty string
    3. selecting the Failsafe option from the Greeter
    File Description
    /etc/gdm/failsafe BlacklistList of devices and driver to blacklist
    /etc/gdm/failsafeDexconf Script that uses dexconf to generate xorg.conf.failsafe
    /etc/gdm/failsafeXinit Stripped down script to start X in failsafe mode
    /etc/gdm/failsafeXServer Stripped down script to start X in failsafe mode
    /etc/gdm/XkeepsCrashing Script called by gdm if X server fails to start

    BulletProof-X in GDM - /etc/gdm/gdm.conf

    .....
    [daemon]
    FailsafeXServer=/etc/gdm/failsafeXServer
    XKeepsCrashing=/etc/gdm/XKeepsCrashing