I connected to my Mint18 (Ubuntu 16.04) system remotely from my windows10 machine with Putty. The internet connection is provided with a Wi-Fi and a VPN connection. I name, here, the IP address for the Wi-Fi connection as Wi-Fi-IP and for the VPN connection as VPN-IP.

I want to run graphical programs such as gedit on the remote Mint18 system; however, I only face with the Cannot Open Display error. I studied all the provided solutions for X11 forwarding:

  • Installed Xming
  • Enabled the X11 forwarding in the Putty
  • Set the X display location as localhost:0.0 in the Putty (I also tried all the steps without setting this!)

After connecting to the remote system, I did the following steps:

  • In the /etc/ssh/ssh_config:
    • Removed the hash # in the lines ForwardAgent, ForwardX11, ForwardX11Trusted, and set the corresponding arguments to yes.
    • Removed the front hash # before Port 22 and Protocol 2, and also appended a new line at the end of the file to state the xauth file location, XauthLocation /usr/bin/xauth
  • In the ~/.bashrc: Appended export DISPLAY=localhost:0.0. (I name this the DISPLAY-value here for simplicity)
    • I also tried this step with the export DISPLAY=, export DISPLAY=Wi-Fi-IP:0.0, and export DISPLAY=VPN-IP:0.0
  • Another solution was to use export DISPLAY=:0 on the command line. It neither produced the error nor opened the program graphically.
  • Exited the session and opened a new one to let these settings be applied.

After all the steps, I ran gedit & but I got Cannot Open Display:DISPLAY-value error and none of the solutions fixed the problem. How can I fix this problem?

1 Answer 1


In the ~/.bashrc: Appended export DISPLAY=localhost:0.0. (I name this the DISPLAY-value here for simplicity)

Remove this from your .bashrc. It's not the correct value for the remote system. The correct value is likely to be something like "localhost:10.0", but it can change for various reasons.

It shouldn't be necessary for you to set DISPLAY on the remote system. If your client (putty) negotiates X forwarding with the server, then the server will set DISPLAY to the correct value for you inside the remote session.

If you log into the remote system and DISPLAY isn't set, then your client may not have negotiated X forwarding.

  • wow! I did many things but this just fixed the issue! Many thanks! Feb 25, 2020 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .