(?) restoring broken X connections

From Mustafa C. Kuscu

Answered By Jay R. Ashworth, Rick Moen, Robos, Heather Stern, Kapil Hari Paranjape

Hi, James. When a remote X-forwarding ssh connection is broken, all the windows at my local server get lost. Is there a way to prevent the remote processes from shutting down, so as to resume the processes and have the windows re-sent to the local X-server when I relogin?

Thanks Mustafa

(!) [jra] Not per se, but investigate VNC. I'm in the midst of writing an article on it as it happens, but it can be used to do what you need.
(!) [Rick] Jay, just to help: I know of these VNC implementations (also known as "RFB" = Remote Frame Buffer):
You'll find a number of resources about VNC over SSH in my ssh-clients file, http://linuxmafia.com/pub/linux/security/ssh-clients
Also worth looking into:
(!) [Robos] Well, not entirely true IIRC since I had some thoughts about this lately too and shortly after that a friend of mine told me that there exists something like screen for xserver connections. And now guess what, he and me forgot it again. Great. So, it exists, but somewhere and I can't tell where...
(!) [Rick] Possibly, you're trying to think of xnest?
(!) [Heather] I suspect not; xnest handles issues about color depth, not being able to set processes to sleep and waken them up from another console.
(!) [Kapil] Actually you may mean "ratpoison" but that is only a window manager which has a "screen"-ish look and feel.
The following setup works well for me from home and work.
At work:

start ratpoison
get ratpoison to start rfb (or to give its full name x0rfbserver).
get ratpoison to start a screen session.
Do some real work via screen.
(All programs that invoke graphics work via ratpoison).
At Home:

run ssh -L 5900:localhost:5900 to the work machine.
on the remote machine run "screen -D -R"
start xvncviewer on the local machine.
Do some real work via screen!
Thus text based applications work via ssh and screen so are reasonably fast. Meanwhile any remote program that invokes graphics creates a window within the xvncviewer.
Needless to say ratpoison runs at home too!
I was quite pleased when I cooked up this config as you can see!
As long as the machine at work continues to run none of the sessions is ever exited or lost. VNC and screen passwrods provide some security as well.
Hope this helps,
(!) [Robos] Nope, I found it! I actually mean - xmove! Look here:
Thats also the thing the original querent might wanna have.
(!) [Kapil] I tried out "xmove". Er, ... just one problem. It uses TCP connections to connect with the xserver which means that X with "-nolisten tcp" does not work.
In the modern security conscious world this is essentially all X servers!
(!) [Robos] Well, thats true. But, you can either remove the call in /etc/X11/xinit/xserverrc and maybe /etc/gdm/gdm.conf (dunno for kdm or xdm) or ssh -X _should be permitted if I gather some comment I read correctly. The say the others?
(!) [Heather] As far as X is concerned ssh -X merely yields a valid server running at a higher screen number - 10 rather than 1 is typical, so localhost:10 would send all processes down the ssh pipe back to where you are sitting.
If you're sure it works at the TCP level it may not work. If it works with normal TCP/IP packets, then it can surely be tunneled. But you can try playing games with ssh at the transport layer first. There are stacks of examples for POP over SSH out there; that's how they work, so it's worth a look too.

Copyright © 2002
Copying license http://www.linuxgazette.net/copying.html
Published in Issue 85 of Linux Gazette, December 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/

[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4 [ Index of Past Answers ]