1. Home
  2. Tutorials
  3. GDM and XDMCP
Yolinux.com Tutorial

GDM and XDMCP configuration for remote graphical Linux desktop access

Linux installations default to a secure configuration which does not allow remote graphical logins or remote desktop access. This tutorial details configuration changes to allow remote access using X-Windows XDMCP and GDM, XDM or KDM (GUI login). XDMCP is not regarded as secure over a public network. See FreeNX for a more secure alternative.

Linux configuration for a GUI login:

Typically Linux configures the choice of a text console login or a graphical GUI login in the init script configuration file /etc/inittab. In order to allow remote a GUI login, the system itself must be configured for a X11 GUI login.

# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
(Partial file listing)

Note that this shows a run level of "5" for a Red Hat / Fedora / CentOS based configuration.

Ubuntu:

  • Start GDM manually with the command: /etc/init.d/gdm or on system boot.
    (This can be added to the system init process: ln -s /etc/init.d/gdm /etc/rc2.d/S13gdm)
    or
  • add to /etc/inittab
    x:2:respawn:/usr/sbin/gdm
        
    Ubuntu uses runlevel 2-5 as regular multi-user mode.

Also see the YoLinux.com Linux init process tutorial.

Granting remote GUI desktop access to your system:

The system login manager provides the GUI screen presented to the user for one to login to the system. The system admin can configure the system to use the following Login/Display Managers:

  • RHEL: XDM, GDM, KDE
  • Ubuntu: LightDM, GDM, KDM
The typical default of modern Linux systems (current Red Hat or Ubuntu) is to use Gnome GDM. Older systems used the X11 login manager XDM. It is still available and a valid option. The system is typically configured for a single login display manager. Multiple display managers can run simultaneously only if they are configured to manage different servers (not covered in this tutorial).

In order to use the Linux desktop remotely, the login manager must be configured for remote use.

RHEL XDMCP Configuration:

How to set the default display manager and configure it for remote XDMCP desktop display.

Display Manager Default:

The default display manager for Red Had based systems can be set in /etc/sysconfig/desktop
Desktop choices: GNOME, KDE
Display Manager choices: GNOME, XDM, KDE

Example /etc/sysconfig/desktop
DESKTOP="GNOME"
DISPLAYMANAGER="GNOME"
Specifying GNOME as a display manager will invoke GDM.

Upon boot, the system will run /etc/init/prefdm.conf which will in turn call the "Preferred Display Manager" (prefdm) script /etc/X11/prefdm which will utilize the settings in /etc/sysconfig/desktop if available.

XDM login manager configuration:

  • Required RPM Package: xorg-x11-xdm

  • Edit file:
    • Red Hat: /etc/X11/xdm/Xaccess
    • Suse: /usr/X11R6/lib/X11/xdm/Xaccess

    Change from:
    # *                                       #any host can get a login window
    To:
    *                                       #any host can get a login window

  • Edit file: /etc/X11/xdm/xdm-config
    Change last line from:
    ! SECURITY: do not listen for XDMCP or Chooser requests
    ! Comment out this line if you want to manage x terminals with xdm
    
    DisplayManager.requestPort:    0
              
    To:
    !DisplayManager.requestPort:    0
              
    System default for RHEL4/FC3.

  • Remote XDM Login Screen:
    Red Hat Enterprise Linux XDM login screen

GDM login manager configuration:

  • Required RPM Package: gdm

  • Edit file:
    • Red Hat Enterprise 5/6, CentOS 5/6: /etc/gdm/custom.conf
      Add two entries to the existing categories:
      ..
      ...
      
      [xdmcp]
      Enable=true
      
      [security]
      DisallowTCP=false
      
      ...
      ..
                  
      Valid options and system defaults can be found in /etc/gdm/gdm.schemas
      One can also use the GUI config tool /usr/sbin/gdmsetup.
      (No longer available on RHEL6. Configure by editing config files)

    • Red Hat Enterprise 3/4, CentOS 3/4, Fedora 1-6: /etc/X11/gdm/gdm.conf
      Ubuntu: /etc/gdm/custom.conf
      Change last line from:
          [xdmcp]
      Enable=false
      To:
          [xdmcp]
          Enable=true
                  
      Valid options and system defaults can be found in gdm.schemas
      One can also use the GUI config tool gdmsetup (see below).

  • Restart X-Windows using one of the following methods:
    • Restart using init:
      • [root]# init 3
      • [root]# init 5
      [Potential Pitfall]: When using Linux terminals F2, F3, etc note that the command "init 5" may push you to a different console terminal. Use ctrl-alt-F7 to navigate to the graphics console. Remember to navigate to the console terminal from which you entered the command as it will still be logged in.

    • Restart using the keystroke ctrl-alt-Backspace

  • Remote GDM Login Screen:
    Red Hat Enterprise Linux remote Gnome login screen

Note:

  • You can use the config tool /usr/sbin/gdmsetup to configure GDM (see below).
  • You can test the GDM login screen locally: X -query localhost :1

[Potential Pitfall]: RHEL6 users may find that the remote X-server has a blank screen when trying to start a remote XDMCP desktop. This may require a change to the default sshd configuration.

Edit file: /etc/ssh/sshd_config
be sure the following three lines are uncommented:
..
...

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

...
..

You will have to restart sshd and the window manager to pick up the configuration changes:
  • service sshd restart
  • ctrl-alt-Backspace

KDE login manager configuration:

  • Required RPM Package: kdm

  • Edit file: /etc/kde/kdm/kdmrc
    ..
    ...
    
    [Xdmcp]
    Enable=true
    Willing=/etc/kde/kdm/Xwilling
    Xaccess=/etc/kde/kdm/Xaccess
    
    ...
    ..
              

  • Edit file: /etc/kde/kdm/Xaccess
    Change from:
    # *                   #any host can get a login window
    
    ...
    ...
    
    # * CHOOSER BROADCAST #any indirect host can get a chooser
    
              
    To:
    *                   #any host can get a login window
    
    
    * CHOOSER BROADCAST #any indirect host can get a chooser
              

  • Restart the window manager: ctrl-alt-Backspace

  • Remote KDM Login Screen:
    Red Hat Enterprise Linux KDM login screen

GDM Configuration using gdmsetup:

gdmsetup: This GUI will edit the configuration GDM configuration file. Note that this GDM configuration GUI is no longer available with RHEL6. One must edit config files to configure GDM.
  • Red Hat Enterprise 5, CentOS 5: /etc/gdm/custom.conf
  • Red Hat Enterprise 3/4, CentOS 3/4, Fedora 1-6: /etc/X11/gdm/gdm.conf

Select the check box "Enable XDMCP":
Configuration screen: gdmsetup XDMCP
Configuration screen: gdmsetup security

Ubuntu XDMCP Configuration:

The config file /etc/X11/default-display-manager sets the system default and is typically:
/usr/sbin/lightdm
          
Options:
  • /usr/sbin/lightdm (typically the Ubuntu default: 12.04)
  • /usr/sbin/gdm
  • /usr/bin/kdm

The default can also be reset using the GUI console configuration tool:
sudo dpkg-reconfigure lightdm
In this example the default is being set to "lightdm". Valid options include "gdm" and "kde".

LightDM Configuration: (Ubuntu 12.04)

Add the following to the file: /etc/lightdm/lightdm.conf
...
...

[XDMCPServer]
enabled=true

          
Restart LightDM: sudo lightdm restart

GDM Configuration: (Ubuntu 10.04)

Add the following to the file: /etc/gdm/custom.conf
...
...

[daemon]
RemoteGreeter=/usr/lib/gdm/gdmlogin

[xdmcp]
Enable=true
          
Restert GDM: sudo gdm restart

KDM Configuration:
  • Required Ubuntu Package: kdm

  • Edit file:
    • Ubuntu: /etc/kde4/kdm/kdmrc
    ..
    ...
    
    [Xdmcp]
    Enable=true
    Willing=/etc/kde/kdm/Xwilling
    Xaccess=/etc/kde/kdm/Xaccess
    
    ...
    ..
              

  • Edit file: /etc/kde4/kdm/Xaccess
    Uncomment the lines and change to:
    *                   #any host can get a login window
    
    
    * CHOOSER BROADCAST #any indirect host can get a chooser
              

  • Restart the window manager: ctrl-alt-Backspace

Ubuntu KDM Config Files:
  • /etc/kde4/kdm/backgroundrc : background settings
  • /etc/kde4/kdm/kdm.options : options for X display manager kdm
  • /etc/kde4/kdm/kdmrc : kdm configuration file
  • /etc/kde4/kdm/Xaccess : access control file for XDMCP connections
  • /etc/kde4/kdm/Xreset : script to run as root after session exits
  • /etc/kde4/kdm/Xsession : script to run as user after login of user
  • /etc/kde4/kdm/Xsetup : script to run as root before the login dialog appears
  • /etc/kde4/kdm/Xstartup : script to run as root before session starts
  • /etc/kde4/kdm/Xwilling : output of this script is displayed in the chooser window

Configuration Pitfalls:

  • Make sure the system firewall rules allow XDMCP protocol to pass.
    • List firewall rules: iptables -L
    • Flush all firewall rules: iptables -F
    The following ports and protocols must be able to pass through the firewall:
    • UDP: 177 (XDMCP)
    • TCP: 6000-6005 (X11 protocol)
    • TCP: 7100 (xfs: X font server)

Remote X server access for MS/Windows:

Open Source MS/Windows PC X-Windows server software:

Commercial MS/Windows PC X-Windows server software:

Also see accessing Linux from Microsoft Windows for more remote X-Windows configuration information.

Remote X server access for Linux:

Use the X-Windows Xnest command to connect.

/usr/bin/X11/Xnest -query computer-node-name -geometry 1280x1024 :1
Xnest image
Example using option "-geometry 850x680".

[Potential Pitfall]: If your get the following error message:

Fatal server error:
Server is already active for display 0
This means you forgot the ":1" at the end of the command and it defaulted to :0 which is your current desktop window thus causing a conflict.

Red Hat / Fedora / CentOS distributions require package xorg-x11-Xnest

Links:

   
Bookmark and Share

Advertisements