X11 forwarding refers to executing such a program remotely through an SSH (Secure Shell) connection. It’s mean the executable file itself is hosted on a different machine than where the graphical interface is being displayed. The graphical windows are forwarded to your local machine through the SSH connection.
Step 1: Install Required Packages
First install the required packages using below command.
# yum install -y xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-apps
Step 2: Enable X11 Fowarding
After installing the required packages enable the X11 from ssh configuration file.
# vim /etc/ssh/sshd_config
Uncomment or add the below lines.
X11Forwarding yes
Step 3: Restart SSH Service
Once the config file’s modifications have been made to your Linux system, the SSH service will need to be restarted to effect the revised configuration.
For CentOS/RHEL 7
# systemctl restart sshd
For CentOS/RHEL 6
# service sshd restart
Step 4: Test Connection
Now verify the connection using below command.
Access Putty
Enable X11 in Putty, before login.
Connection >> SSH >> X11:
Check Enable X11 forwarding
X Display location: localhost:0
Run below command to test the connection.
# xclock&
OR
# xeyes&