How to configure X11 Forwarding over SSH

Share on Social Media

In this Linux tutorial, you will learn, how to configure X11 Forwarding over SSH. #centlinux #linux #ssh

Problem Statement:

Usually, Graphical mode is turned off in Linux servers due to Security and Resource optimization. In such environments running a GUI application is not a trivial task. However, we can use PuTTY and XMing to forward X11 display to a windows client over SSH protocol.

In this article, we will first install required packages on our Linux Server, then we will configure X11 forwarding over SSH on windows by using PuTTY and XMing.

System Specification:

One Microsoft Windows client and a Linux server.

Required Software:

Download and Install following two software on Windows client.

PuTTY
XMing X Server for Windows

Install required packages on Linux server:

Connect to Linux machine and install necessary packages for X11 forwarding.

# yum install -y xauth

We will require a Linux GUI application to test X11 forwarding configurations. Therefore, we are installing xclock to test the configuration.

# yum install -y xclock

Configure XMing:

After installing Xming on Windows run xlaunch application.

putty-configure-x11-forwarding-on-windows-01
putty-configure-x11-forwarding-on-windows-02

Default configuration will work for us. Therefore, click on Next.

putty-configure-x11-forwarding-on-windows-03

Click on Next.

putty-configure-x11-forwarding-on-windows-04

Click on Next.

save configuration

Click on Finish.

XMing application has been started and it is placed in System Tray of Windows.

Configure PuTTY:

Once installed, run PuTTY application.

putty-configure-x11-forwarding-on-windows-06

Add a session of our Linux machine therein.

putty configuration

Besides other configuration, we are also required to configure X11 forwarding as follows:

enable x11 forwarding

Save and open the session.

login as: root
Authenticating with public key "rsa-key-20190101"
Last login: Tue Jan  1 21:16:23 2019 from 192.168.116.1
/usr/bin/xauth:  file /root/.Xauthority does not exist
# xclock

Xming will capture the Display open a window to run xclock application.

putty-configure-x11-forwarding-on-windows-09

Conclusion – Configure X11 Forwarding over SSH:

In this Linux tutorial, you have learned, how to configure X11 forwarding over SSH by using PuTTY and XMing.