derekswanson08
derekswanson08

Reputation: 177

Cygwin XWin server randomly loses connection

I am using cygwin to ssh into a remote linux box and am using the cygwin XWin server to display gui applications.

When I first connect to the remote machine, the following warnings are displayed:

Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.

Regardless of the warnings, XWin seems to work perfectly at first. After a while (usually about 15 min) it will inevitably lose connection. The cygwin X server icon still shows up in the windows taskbar, so I know it is still running. So far the only workaround I have found is to log out and then ssh back in again. Super annoying! Please help!

gvim and xterm dont work because XWin stopped working

Thanks,

-Derek

Upvotes: 1

Views: 2048

Answers (3)

jturney
jturney

Reputation: 2559

tl;dr use ssh -Y

Since openssh 5.6, when you connect with ssh -X, requesting an untrusted connection, the ForwardX11Timeout value (which defaults to 20 minutes) is enforced, even if untrusted X11 forwarding setup failed and a trusted connection was made. (I can't find any announcement of this change, but see [1] for the relevant code change).

This timeout is part of the "security" policy you are asking for when you use ssh -X, and prevents new connections being made to the X server after the timeout has expired.

If you add the -v option to ssh, which is often helpful when investigating ssh problems, you should get a "Rejected X11 connection after ForwardX11Timeout expired" message when you attempt to start a new client.

[1] http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/clientloop.c.diff?r1=1.220;r2=1.221;f=h

Upvotes: 2

derekswanson08
derekswanson08

Reputation: 177

I fixed the problem by using:

ssh -Y user@server 

instead of

ssh -X user@server

Apparently, the -Y and the -X flags both do the same thing (enable X11 forwarding). The difference is that -X uses a secure mode and -Y uses a trusted mode. Only use -Y if you trust the machine you are connecting to. If you use -X, then the remote machine will be limited in what it can do with your display. For me, this meant that my display would time out after a while. Using -Y instead, my connection never times out.

Upvotes: 3

rhi
rhi

Reputation: 11

when I read "remote" I think Firewall. Could it be that you have an inactivity-timer on the ssh-session that's causing it to "tear-down" after a while? If so, you would find traces of that in the various logs (server & firewall). If not, and it's just a general cygwin-X-stability-problem, you might want to consider using virtualbox | vmware and a linux-distro of your choice on your windows-Box. If you use "nat" as ethernet-device it will piggy-back on your windows's IP; if you need to ssh "into" your VM-Guest you can set up windows to pass incoming tcp/22 onto the VM-Guest's stack. (won't work if you're using cygwin's sshd on tcp/22) ; else good luck //rhi

Upvotes: 1

Related Questions