How to make PuTTY X11 forwarding work in a screen session?
Posted
by
Alex Howell
on Super User
See other posts from Super User
or by Alex Howell
Published on 2011-01-06T21:43:34Z
Indexed on
2011/01/06
21:55 UTC
Read the original article
Hit count: 373
I'm using PuTTY with X11 forwarding enabled, using Xming as my X server on Windows 7.
When I SSH to a Linux host, X11 forwarding works fine.
If I start a "screen" screen manager session, it still works fine.
If I disconnect from the screen session, then later resume in a different PuTTY window using "screen -rd"
, X11 forwarding doesn't work any more - I get an error:
xterm X connection to localhost:11.0 broken (explicit kill or server shutdown).
This seems to be because $DISPLAY is different in each PuTTY SSH session (localhost:11.0 in the first session, then localhost:12.0 in the next, and so on). If I manually set $DISPLAY to localhost:12.0 in the screen session, X11 forwarding works again.
Is there a way to automatically set $DISPLAY in the screen session, each time it's resumed, so that it always matches the parent PuTTY session's?
© Super User or respective owner