10

I am no longer able to forward X11 using KiTTY/PuTTY to CygwinX.

I am connecting to an Ubuntu Server 14.10 machine that is correctly configured to allow X11 forwarding. I am able to initiate X11 forwarding using Cygwin xterm and from other linux machines.

I am using CygwinX [1.7.34(0.285/5/3)] and KiTTY 0.64.0.1 (PuTTY fork, I have also tried PuTTY), on Win7.

I have verified my display variable and have tried disabling xhost access control in Cygwin xterm.

$ echo $DISPLAY
:1

$ xhost +
access control disabled, clients can connect from any host

My KiTTY/PuTTY is configured to enable X11 forwarding and the correct display is set. I've tried :1 and :1.0.

KiTTY X11 Config Screenshot

When I SSH to the server my DISPLAY variable is set and xauth is updated. I have deleted my .Xauthority and recreated it to verify.

user@server:~$ echo $DISPLAY
localhost:10.0
user@server:~$ xauth list
server/unix:10  MIT-MAGIC-COOKIE-1  3983b2d7f3d5f9f66d9796997771bf82

When I attempt to launch an X11 application I get the following error.

user@server:~$ xterm
KiTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
xterm: Xt error: Can't open display: localhost:10.0

XWin.exe is listening on port 34576 if that matters.

[XWin.exe]
 TCP    127.0.0.1:34576        0.0.0.0:0              LISTENING

I believe there is a software or configuration issue I am missing as I am seeing this with multiple server and client machines. Any help would be appreciated.

  • $DISPLAY on the remote machine should point to the address of your desktop, not localhost. – lcd047 May 7 '15 at 17:07
  • 2
    @lcd047 No, absolutely now. $DISPLAY on the remote machine should point to localhost. SSH does the forwarding. – Gilles May 7 '15 at 20:41
  • I installed 32 bit Cygwin to eliminate Cygwin64 as a variable. No change. Still receiving the connection refused error. – SeeJayEmm May 7 '15 at 21:58
  • @Gilles: The point I was trying to make was that since $DISPLAY on the remote machine doesn't point to the OP's desktop, the X11 forwarding didn't happen. Otherwise, $DISPLAY on the remote machine might not even exist if the remote machine isn't running an X server itself (which has nothing to do with the initial question anyway). – lcd047 May 8 '15 at 4:08
  • 3
    @lcd047 No. Please check your facts. If the X11 forwarding happens, then DISPLAY points to localhost. SSH listens on a TCP port on the remote machine and forwards the packets. If DISPLAY pointed to the local machine, that would indicate that it is not forwarded through SSH, but on a direct TCP connection — in cleartext, and possibly to an IP address that doesn't even have a route. – Gilles May 8 '15 at 11:05
9

Ok, I figured out the solution to my own problem.

By default CygwinX no longer listens for tcp connections (Cyg SSH is using Unix sockets to connect). To enable tcp connections "-listen tcp" needs to be added to the command line parameters. In my case I changed the "XWin Server" icon to read:

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/startxwin -- -multiwindow -listen tcp"
  • This works great for me, thanks! But how can I avoid having to do xhost +localhost (or a safer solution) in a local cygwin terminal everytime I start the X server? – chappjc Sep 17 '15 at 17:54
  • 1
    Well, I added xhost +localhost in startxwin right near the end of the file, inside the last conditional: xhost +localhost fi exit $retval – chappjc Sep 17 '15 at 18:45
  • what about for putty? – Brian Thomas Feb 24 '17 at 1:05
  • @BrianThomas Can you clarify your question? What about PuTTY? The PuTTY config in my original post was valid. The issue was with CygwinX. – SeeJayEmm Feb 24 '17 at 15:10
  • Well, i was referring to the title, Putty not connecting, the answer is for Cygwin, and not for putty, yet i see a putty screen in the OP. Anyhow i figured it out. For putty, the solution to my problem was to make sure only one Xserver (XMing in my case) was running, and that there was no errors in the log on the startup, and its mandatory to specify the display :10 worked for me. (ok, i can see how this doesnt pertain to your answer, since your the original OP, however, theres other people in here too, this issue can be pretty wide. so hopefuly this is helpful to others.) – Brian Thomas Feb 25 '17 at 1:40
0

I had this problem. It was because X-Win wasn't running. If you want X-Win to run on startup go "run" then "shell:startup" and copy the x-win shortcut into that folder.

0

In my case, the error was similar "putty x11 connection refused". I was logging in via a windows machine into a Ubuntu 16 server via putty (with x11 forwarding enabled).

Tried a whole lot of things from re-generating .Xauthority files to adding magic cookie in using xauth list. However, issue was simply that Xming server wasn't running on my windows machine. Once I started Xming on the host machine (windows) on which I was spawning the putty, login via Putty worked like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.