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.
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
In order to use the Linux desktop remotely, the login manager must be configured for remote use.
- # Red Hat Enterprise Linux (RHEL) XDMCP Configuration (includes Fedora and CentOS)
- # Ubuntu Linux 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
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:
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]
To:
Enable=false
[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).
- Red Hat Enterprise 5/6, CentOS 5/6: /etc/gdm/custom.conf
- Restart X-Windows using one of the following methods:
- Restart using init:
- [root]# init 3
- [root]# init 5
- Restart using the keystroke ctrl-alt-Backspace
- Restart using init:
- Remote GDM 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:
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":
The config file /etc/X11/default-display-manager sets the system default and is typically:
/usr/sbin/lightdmOptions:
- /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=trueRestart 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=trueRestert 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
- Make sure the system firewall rules allow XDMCP protocol to pass.
- List firewall rules: iptables -L
- Flush all firewall rules: iptables -F
- UDP: 177 (XDMCP)
- TCP: 6000-6005 (X11 protocol)
- TCP: 7100 (xfs: X font server)
Open Source MS/Windows PC X-Windows server software:
- Xming - [instructions] - X-Windows for MS/Windows - My preferred choice!
(Remote X-Desktop access using Xming) - Cygwin/X: See the YoLinux Tutorial - Linux for a Microsoft Windows Environment and Network for Cygwin configuration.
Commercial MS/Windows PC X-Windows server software:
Also see accessing Linux from Microsoft Windows for more remote X-Windows configuration information.
Use the X-Windows Xnest command to connect.
/usr/bin/X11/Xnest -query computer-node-name -geometry 1280x1024 :1![Xnest image](images/Xnest_w740.gif)
Example using option "-geometry 850x680".
[Potential Pitfall]: If your get the following error message:
Fatal server error: Server is already active for display 0This 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