On the X Display server, use the xhost + command to allow any client to connect to the X Display server.
[root@server1 ~]# xhost + access control disabled, clients can connect from any host
On the X Display server, use the xhost - command to deny any client to connect to the X Display server.
[root@server1 ~]# xhost - access control enabled, clients cannot connect from any host
You can also append specific computer hostnames or IP address to only allow or deny certain computers to be able to connect to the X Display server.
[root@server1 ~]# xhost + example.com
Ensure the /etc/ssh/sshd_config file on the OpenSSH server is configured to allow X11 sessions.
X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost yes
Configure PuTTY to use X11 forwarding:
- In the left panel of PuTTY, expand Connection > SSH, and select X11.
- Tick Enable X11 forwarding.
- Connect to the OpenSSH server.
From a Linux client PC in the network, make an SSH connection to the X server. The terms SSH tunneling and SSH forwarding are used to describe the concept of using SSH to smuggle non-SSH traffic between hosts. Once connected to the X server, determine if the DISPLAY environment variable contains a value. In this example, echo $DISPLAY does not produce any output.
[root@server1 ~]# echo $DISPLAY
If the DISPLAY environment variable does not produce any output, use the export DISPLAY command followed by the hostname or IP address of the client PC to configure the DISPLAY environment variable to the client machine.
[root@server1 ~]# export DISPLAY='example.com:0.0'
Echo $DISPLAY should now produce the hostname or IP address of the client PC.
[root@server1 ~]# echo $DISPLAY 192.168.0.5
You will still have a non graphical display. However, you can start x programs. For example, the xclock command can be used to display the clock. The graphical clock will be displayed.
[root@server1 ~]# xclock