Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using X11 forwarding over ssh to run Linux apps on my Windows box, and when the network drops the lose everything that was running. Is there anything similar to screen for X11?

share|improve this question
    
Clarify. Why not just use screen? Or XVNC? You run screen on the Linux machine and when your network drops, reconnect and use screen -DR to reattach the session. –  nix Apr 4 '11 at 19:34
    
@nix Will that work for X apps? –  Michael Mrozek Apr 4 '11 at 19:44
2  
@nix I don't think screen works for gui apps. –  Abdullah Jibaly Apr 4 '11 at 19:51
    
Of course, screen would require running from an xterm. –  nix Apr 4 '11 at 20:02
add comment

3 Answers

Xpra or the Xpra fork claim to be exactly that:

So basically it's screen for remote X apps.

I haven't used it in a while, but it worked pretty well when I tried it. You start the server on the remote machine:

[remote] $ xpra start :13

Then you attach to the server from your local machine:

[local] $ xpra attach ssh:remote:13

And now anything displayed on X display 13 on the remote machine will appear locally:

[remote] $ DISPLAY=:13 xeyes
share|improve this answer
4  
There's also WinSwitch, which at a glance looks like it integrates xpra and other related software. –  Gilles Apr 4 '11 at 19:55
add comment

You're looking for VNC. The principle somewhat is similar to screen: you run a VNC server (the backgound SCREEN process), and a VNC client (the foreground screen process). The VNC server is an X server, so you can run X applications in it.

Run a VNC server on the Linux box and a client on the Windows box. You have several implementations to choose from; one possibility is TightVNC. TightVNC is in many Linux distributions (if it's not in yours, either install it or pick a different implementation), and there's a Windows client.

If your two machines aren't very close on the network — if there's a firewall or a risk of eavesdropper between them — you'll need to tunnel the VNC traffic through ssh. Have ssh forward the local port 5900 to the remote port 5900 (5900 corresponds to the display :0, use 5901 for `:1, etc.).

share|improve this answer
add comment

Actually, you can forward X into screen.

Only thing to do is to set up the $DISPLAY in the screen window so that it is the same out side of it.

Procedure: after ssh -X into the remote machine, type

echo $DISPLAY

and copy the result, usually localhost:N.0. Then enter screen, in the local screen window,

export DISPLAY=localhost:N.0

After this, run any X required program within the screen window will do.

Note that for each screen window, the environment variables are independent. So for each window, you might need to set it up separately.

For reference, check this question out.

http://askubuntu.com/questions/9920/x11-forwarding-over-gnu-screen-is-it-possible

share|improve this answer
    
Hi Chong, welcome to unix.SE. Since the details of the solution you link are simple, it's better to re-write them explicitly here. This way the answer is preserved should something happen to the post on askubuntu.com. Of course, it's a good idea to keep the link present as well because it helps to source your material. –  drs Jun 19 at 16:55
    
@drs It's done. Thanks for reminding. –  Chong Jun 19 at 17:07
    
I tried this solution, but I cannot close my ssh session without killing the running X application. This somehow defeats the purpose of it... How should I disconnect from the remote host leaving the remote application running? –  Tonin Jun 23 at 12:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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