Ssh – How to display an X11 screen from a remote machine? (Alternative to ssh -X)

framebufferssh-tunnelingx11xvfb

I am locally on a machine without root rights. X forwarding is disabled.

Remotely I am running a process on a machine without a screen, using the Xvfb virtual framebuffer which simulates an X server but discards any image displayed. This works reasonably well.

Now, some things are not working, and I need to debug by looking at the X screen. I did take a screenshot in Xvfb with xwd -display :99 -root -out /tmp/screenshot.xwdump but it is quite complicated to look at many of them in a sequence.

Is there a way to connect with from my client to the server, and then connect to the framebuffer in order to display the remote X window locally?

This could be a second ssh channel. The X program should ideally keep on running after disconnecting and I would like to be able to start it before the second connection if possible (think spice).

I only have outgoing connections to the server, and only to port 22. On neither machine root rights are available.

PS: This question is similar to Running programs over ssh but my requirement is that no program can be installed as root on client or server which seems to rule out xpra (the answer given there) unless I find an easy way to use it.

Best Answer

xpra is your friend: http://xpra.org/. Install xpra on server and client.

Start xpra server over ssh with

xpra start-desktop ssh:user@server:XVFBDISPLAY --use-display --start-via-proxy=no

Alternatively: If you are already logged in to the server, you can start xpra server with

xpra start-desktop :XVFBDISPLAY --use-display --start-via-proxy=no

Start xpra on client with

xpra attach ssh:server:XVFBDISPLAY

You can detach and reattach later again:

xpra detach ssh:server:XVFBDISPLAY

(Replace XVFBDISPLAY with the display number of Xvfb.)

Related Question