putty + xming: cannot connect to Xserver in Windows 7

5YrsLaterDBA picture 5YrsLaterDBA · Feb 9, 2015 · Viewed 10.8k times · Source

I am trying to use putty and XMing to run programs from my Fedora 20. I used this configuration before on other machines and I was able to run GUI programs on Linux and display them in my windows 7. But this time I have trouble and get the "cannot connect to X server" error when I try to launch kwrite and kdesvn which are GUI programs in Fedora 20. The connections were good. And the XMing server was running and the X11 forwarding was enabled in putty, like the instruction here.

From my another Fedora 20 machine, I was able to connect to and run GUI programs from the target machine with ssh -X and the same username. So I am thinking the settings of the target machine was right.

Then what else I can try? how to figure out where the problem is?

Answer

SeeJayEmm picture SeeJayEmm · Feb 20, 2015

Ensure that X11 forwarding is enabled in /etc/sshd_config.

X11Forwarding yes

Ensure in your home directory that you have an .Xauthority file. Permissions should be set 0600. If the file does not exist create it.

touch ~/.Xauthority
chmod 0600 ~/.Xauthority

As was previous stated first make sure that X11 forwarding is enabled in PuTTY. Config > Connection > SSH > X11 > Enable X11 Forwarding. Based on your question it appears you already did this. Make sure you save this config.