Attempting to run XMing, the remote host is Ubuntu, going through Putty. Have spent hours carefully double-checking all settings, reviewing XMing's troubleshooting guide, etc. Rather than continuing this path, I want to use a tracing tool or sshd logging to somehow identify exactly why I'm getting the "can't open display" error. This occurs when I test by runningxclock or firefox.

I've turned off firewalls on each computer.

One thing that bothers me: in Putty I'm setting the X display location to localhost:0, which they say sets the DISPLAY variable on the remote host. But after logging in through Putty, I do an echo $DISPLAY and it shows nothing. Shouldn't it return localhost:0?

What tools or logs or other approach could I use to figure out what's wrong?

  • I'm also experiencing this exact same scenario... have you figured this out?
    – sam yi
    Aug 12, 2016 at 10:08
  • @David would you mind choosing an answear or are there still problems you face?
    – hub
    Feb 21, 2018 at 14:04

4 Answers 4


Try to set the display location to localhost:0.0 instead of localhost:0.

enter image description here

If this wont work, at /etc/ssh/sshd_config check for LogLevel variable to be set to LogLevel INFO.

Now you could retry your connection and do the following for more log information: sudo cat /var/log/* | grep DISPLAY or sudo cat /var/log/* | grep ssh or sudo cat /var/log/* | grep sshd etc.


I had to put in /etc/ssh/sshd_config the following:

X11UseLocalhost no

Otherwise the display variable wouldn't get set. Now it works for me.


If you set localhost:0 as "X display location" option in Putty, you should also check that Xming is running on display :0. Xming and Putty display option must have the same value.

Once connected on the Ubuntu, you should run export DISPLAY=, assuming that your client has the address and Xming is running on display :0.

Also, if that does not solve the problem, you can try to launch Xming with the option -ac. To do so on Windows, either launch it from command line, or by making a shortcut in which you append "-ac" in its "target" property. Be careful though, this will allow anyone to use your X server, so do this on trusted networks only. The export DISPLAY command should also be ran on the Ubuntu.

If the option -ac solves the problem, I must say I don't know how to configure Xming or whatever that prevents you to have the same result without -ac.

  • And where would in Xming, such setup be hiding ? Tks.
    – AlexD
    Jul 6, 2021 at 20:58

I'm using ArchLinux as my server and I didn't have xauth installed. I did pacman -S xorg-xauth to have xauth installed and then it worker.

You must log in to answer this question.

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