Xming debian can’t open display

x11xmingxorg

I followed numerous guides for setup and even more "can't open display" error solution, but still can't find what's wrong.
First, on VPS Debian Squeeze I installed xserver-xorg-core and xauth.

Then on Windows 7 installed xming 6.9.0.31.
Then configured putty 2012-11-09:r9690
This is putty config:

putty config

sshd_config on VPS is set to:

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Xauthority file is created in ~/.Xauthority. $DISPLAY is localhost:10.0

I first start xming, then connect with putty.

When I type xlogo I get Error: Can't open display: localhost:10.0.

I put VPS's IP in x0.hosts in xming folder. Tried to change DISPLAY to my IP, :0, localhost:0… I can't even remember the combinations. Tried to put localhost:0 in putty config. I even changed the order of lines in /etc/hosts as I saw in one answer, but nothing works.

Update:
This is putty eventlog:

2013-03-03 15:58:14 Looking up host "IP"
2013-03-03 15:58:14 Connecting to IP port 22
2013-03-03 15:58:14 Server version: SSH-2.0-OpenSSH_5.5p1 Debian-6+squeeze2
2013-03-03 15:58:14 Using SSH protocol version 2
2013-03-03 15:58:14 We claim version: SSH-2.0-PuTTY_Snapshot_2012_11_09:r9690
2013-03-03 15:58:14 Doing Diffie-Hellman group exchange
2013-03-03 15:58:14 Doing Diffie-Hellman key exchange with hash SHA-256
2013-03-03 15:58:15 Host key fingerprint is:
2013-03-03 15:58:15 ssh-rsa 2048 3f:6e:7d:6c:14:6a:3e:18:0d:d4:05:c9:b2:60:d3:00
2013-03-03 15:58:15 Initialised AES-256 SDCTR client->server encryption
2013-03-03 15:58:15 Initialised HMAC-SHA1 client->server MAC algorithm
2013-03-03 15:58:15 Initialised AES-256 SDCTR server->client encryption
2013-03-03 15:58:15 Initialised HMAC-SHA1 server->client MAC algorithm
2013-03-03 15:58:19 Sent password
2013-03-03 15:58:19 Access granted
2013-03-03 15:58:19 Opening session as main channel
2013-03-03 15:58:19 Opened main channel
2013-03-03 15:58:19 Requesting X11 forwarding
2013-03-03 15:58:20 X11 forwarding enabled
2013-03-03 15:58:20 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2013-03-03 15:58:20 Started a shell/command

Where can I check elsewhere?
Any solution to this?

Best Answer

Check if Windows firewall is blocking TCP on localhost:6010.

Try the following little procedure to check if you can connect to the remote X-server (Xming) after setting up an SSH session with PuTTY. Notice port 60xx where xx is identical to the number you find in echo $DISPLAY:

$ echo $DISPLAY 
localhost:10.0
$ netstat -an | grep 6010
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:6010                :::*                    LISTEN     
$ telnet 127.0.0.1:6010
telnet: could not resolve 127.0.0.1:6010/telnet: Name or service not known
$ telnet 127.0.0.1 6010
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

When the X-server cannot be reached this is what happens:

$ telnet 127.0.0.1 6011
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Related Question