Category: Linux

Linux troubleshooting solutions.

  • How to configure X11 forwarding over SSH in AlmaLinux

    How to configure X11 forwarding over SSH in AlmaLinux

    This solution applies to CentOS 5, 6, 7, 8, 9 and gives details of a minimal number of packages for an X11 environment to support X forwarding.


    Setting up the SSH server (X11 forwarding source)

    • Install the following packages as root.
    xorg-x11-xauth
    xorg-x11-fonts-*
    xorg-x11-utils
    dbus-x11
    # dnf install -y xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils dbus-x11
    • For older OS.
    # yum install -y xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils dbus-x11

    Setting up the SSH client (X11 forwarding target)

    • set X11Forwarding to true in /etc/ssh/sshd_config.
    • Install a full GUI on the client system
    • Start a GUI session on the system
    • Open a GUI-based terminal on the system
    • Start the SSH session with the -X option. Run the command ssh -X $HOST where $HOST is the address of the SSH server.
    • After SSH session starts, GUI applications run in the SSH session should appear on the client system.

    Testing

    • Install the xterm package on the SSH server.
    # yum -y install xterm
    
    or
    
    # dnf -y install xorg-x11-apps
    • From the client system connect to SSH server using the -Y parameter.
    $ ssh -Y user@192.168.0.1
    • Run the xterm command
    $ xterm
    • If an xterm window displays, the configuration is working properly.
  • How to configure X11 forwarding to Mac OS X

    How to configure X11 forwarding to Mac OS X

    This guide is confirmed to work on Mac OS X 10.8 “Mountain Lion” and above through OS 13 “Ventura”. All AlmaLinux and CentOS distributions are covered.


    Configure X11 forwarding on the AlmaLinux server.

    Install XQuartz, an X emulator, on the Mac.

    On the Mac OS Terminal and enable Indirect GLX (iGLX), required to run applications that need OpenGL support at the X server side.

    For Quartz 2.7 or earlier vesions, run.

    $ defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

    For Quartz 2.8 or later vesions, run.

    $ defaults write org.xquartz.X11 enable_iglx -bool true

    “X11” in the domain name above should be in capitals, which is case sensitive.

    Start Quartz.


    If -X does not work, use -Y, in this case.

    Check if the DISPLAY environment variable is set and iGLX works.

    $ echo $DISPLAY
    localhost:10.0
    $ glxinfo
    libGL error: No matching fbConfigs or visuals found
    name of display: localhost:10.0
    libGL error: failed to load driver: swrast
    display: localhost:10  screen: 0
    direct rendering: No
    server glx vendor string: SGI
    server glx version string: 1.4
    server glx extensions:
        GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_visual_info, 
        GLX_EXT_visual_rating, GLX_OML_swap_method, GLX_SGIS_multisample, 
        GLX_SGIX_fbconfig

    The libGL error messages can be ignored

    If xdpyinfo shows an error message like below.

    X Error of failed request:  BadValue (integer parameter out of range for operation)
      Major opcode of failed request:  149 (GLX)
      Minor opcode of failed request:  24 (X_GLXCreateNewContext)
      Value in failed request:  0x0
      Serial number of failed request:  26
      Current serial number in output stream:  27

    Check if iGLX is enabled on the Mac OS X.

    $ defaults read org.macosforge.xquartz.X11 enable_iglx
    or
    $ defaults read org.xquartz.X11 enable_iglx

    Sometimes after starting the session, messages like this are shown each time you try to run an X11 program.

    xdpyinfo:  unable to open display "localhost:10".

    Try starting the SSH session from an xterm launched from XQuartz, not from a Mac OS Terminal.

  • How to configure X11 forwarding to Windows based PC?

    How to configure X11 forwarding to Windows based PC?

    The following steps are applicable to all versions of Windows, CentOS, AlmaLinux, and Rocky Linux.

    This knowledgbase is about how to be able to access X client applications (such as system-config-date, xclock, `vncviewer’) from a Linux based server on to a Microsoft Windows desktop.

    These steps are also applicable if you are getting following error when trying to connect vncserver using vncviewer from PuTTy.

    vncviewer: unable to open display

    Installation of prerequisite applications on Linux Server

    If you want to display remote X applications from a Linux server to a windows PC you need to install following apps on the windows based PC.

    • A Xwindows emulator and freely available window manager system for Windows that is ICCCM compliant. Check for details from this external link
    • Make sure remote Linux server is configured for X11 forwarding and has the xorg-x11-xauth, dbus-x11, @Fonts already installed.
    • Check that X11 forwarding is enabled in /etc/ssh/sshd_config by verifying that the line X11Forwarding yes is uncommented. You can use vi to edit file and search for X11Forwarding option.
    • Use below command on remote Linux server to check if required packages are installed.
    # rpm -qa | egrep  'xorg-x11-xauth|dbus-x11' 

    If not installed, install packages by using the following command.

    # yum install xorg-x11-xauth dbus-x11 @Fonts

    Installation of PuTTy and Xming on Windows PC

    Xming

    Download the Xming X server and fonts from external link to your Windows PC client. After installation, make sure that the X server is loaded into memory by checking if its icon appear in the Windows loaded apps tray.

    PuTTy

    Download PuTTY to your Windows client from this external link and install it.

    After installation, open the PuTTY client and select Session to create a new SSH session and save it.

    To enable X11 Forwarding on the newly created session, select the Session you just created and select Load. Then do the following.

    • Under Category tab, select Connection -> SSH -> X11.
    • Check the box labeled ‘Enable X11 forwarding’.
    • Do not set any value for ‘X display location’.

    Click connect to open a ssh shell session from PuTTY on windows PC. On the PuTTy console window enter the following command. This will launch X client app from the remote Linux server and it should appear on your Windows PC.

    # system-config-date

    Notes

    SSH X11Forwarding is designed for launching a single X Window client app. Launching a Desktop Environment (GNOME/KDE) over SSH would not work as expected and is not supported.

    PuTTY doesn’t enable X11 Forwarding by default. Hence it needs to be configured manually.

  • How to configure Gnome to allow remote access using an SSH/X11 connection using Xephyr?

    How to configure Gnome to allow remote access using an SSH/X11 connection using Xephyr?

    • AlmaLinux 8, Rocky Linux 8, CentOS 8.
    • GDM
    • Xephyr

    You can connect to a Linux Gnome desktop from your local PC without a VNC by implementing the following steps. If GUI (GDM or Gnome desktop manager) is already installed on the server than skip step 1 and follow step 2.

    GDM GUI Installation

    AlmaLinu 8, 9

    If your server has AlmaLinux 8 or 9 than execute these commands on the shell as root.

    # yum group install GNOME base-x Fonts
    or 
    # yum groupinstall "Server with GUI

    CentOS 7

    # yum groupinstall gnome-desktop x11 fonts
    or
    # yum groupinstall "Server with GUI"

    CentOS 6

    # yum groupinstall Desktop "General Purpose Desktop" "Desktop Platform" "X Window System"  "Internet Browser" "Graphical Administration Tools" Fonts

    After completing the above steps, change the default systemd boot target to graphical.target. In case of error, try updating the server OS first with ‘yum update’.

    # systemctl set-default graphical.target
    and
    # systemctl isolate graphical.target

    Install Xephyr Package and enable XDMCP

    Install the xorg-x11-server-Xephyr package.

    Configure GDM to enable XDMCP by adding the following lines to /etc/gdm/custom.conf as follows.

    • In the [security] section, add the line DisallowTCP=false.
    • In the [xdmcp] section, add the line Enable=true.
    • AlmaLinux 8 and 9 only: Uncomment the line WaylandEnable=false in the [daemon] section, or add it if the line is missing.

    Restart GDM

    To apply changes.

    # systemctl restart gdm.service

    Connect with Xephyr

    Run the following command while connected to the server using a client that uses SSH with X11 forwarding.

    $ Xephyr :99 -query localhost

    Notes

    • Test the SSH X11 connection using an X11 application xclock.
    • Use the command man Xephyr for more information.