How to configure X11 forwarding to Windows based PC?

x11 forwarding windows

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.