ESDS Knowledge Base


How to configure X11 Display in LINUX or UNIX & troubleshoot DISPLAY variable issues?

If you are using Windows Desktop / Laptop and wanted to run a GUI application on LINUX or UNIX System then you need to use X11. The X11 allows taking GUI access over SSH to any of the LINUX or UNIX systems to run any application/program in GUI.

There are few things that needs to be taken care of:

1. Make sure the X11Forwarding is enabled in the ssh_config file. In Linux, the SSH terminal supports X forwarding by default however for MAC or UNIX (HPUX, AIX, etc..) OS you need to enable by making changes in the config file.

The ssh_config file typically located at /etc/ssh/ssh_config or ~/.ssh/config). Check If ssh_config includes #X11Forwarding no OR X11Forwarding no. Make sure it should be X11Forwarding yes in your ssh_config file.

Steps:  #Vi /etc/ssh/ssh_config  or Vi /etc/ssh/sshd_config

Make sure X11forwarding is yes

2. You must have X Server running on your Laptop/Computer, the X Server manages the interaction between the remote server ( X Client ) and your laptop/computer. You can download and install Xming on your system. Then, start the Xming before connecting to the remote system with your SSH client (for example, PuTTY).

Steps: Open XLaunch and do the below settings highlighted as YELLOW in all below screenshots:

How to configure X11 Display in LINUX or UNIX

Next >>

How to configure X11 Display in LINUX or UNIX 1

Next >>

How to configure X11 Display in LINUX or UNIX 2

Next >>

How to configure X11 Display in LINUX or UNIX 3

3. In PuTTY.exe for Windows, you can enable X11 forwarding in new or saved SSH sessions by selecting Enable X11 forwarding in the “PuTTY Configuration” window.

Steps :: Open PuTTY.ext  >> Go to Connection >>  SSH  >> X11 >> Select Enable X11 forwarding

How to configure X11 Display in LINUX or UNIX 4

4. log in to the server by mentioning IP, Username & Password.

It will auto-set the DISPLAY Variable for this session, which you can check by using the #echo $DISPLAY command.

5. Once you are logged in to the server then execute xclock command, it will open-up xclock in pop-up.

How to configure X11 Display in LINUX or UNIX 5

You are done 🙂

Known Issues in Setting-up DISPLAY or its environment variable.

Error: Can’t open display  OR Error: Can’t open display: localhost:0.0 ==> This issue occurs when DISPLAY is not or not correctly configured. You can crosscheck using the below command:

#echo $DISPLAY

If it shows “DISPLAY: Undefined variable.” That means the DISPLAY Variable is not set.

Solution:: Either configure/set it manually using the below command or simply follow all the above 5 steps to configure the DISPLAY.

Export DISPLAY=localhost:0.0    OR   setenv DISPLAY localhost:0.0

  • DISPLAY is properly configured xclock is also opening however when trying to open any X-based Application then shows below error è It’s an X11Forwarding issue while authentication.

Xlib: connection to “localhost:14.0” refused by server
Xlib: PuTTY X11 proxy: wrong authentication protocol attempted


X11 connection was rejected because of wrong authentication.
X connection to localhost:14.0 broken (explicit kill or server shutdown).

Solution: Edit /etc/opt/ssh/ssh_config OR /etc/opt/ssh/sshd_config, add/modify X11UseLocalhost no.

Re-run your application, It will work J.

Don’t forget to comment if it solves your issue and if it doesn’t then mention the error will try to assist further.

Leave a Reply