SSH: launch GUI programs on remote screen, not X display

any xlib-application must connect to a xserver. you have to tell the app the connection to the server by either:

  • setting the environment variable DISPLAY
  • using a command line flag such as -display

the first xserver usually can be reached by the connection string ':0'. so, try this:

xeyes -display :0

or this

env DISPLAY=:0 xeyes

Is this workstation running an X Windows server? Without that, this is all moot.

You need SOMETHING to process the data into graphics, pixels, colors and locations. A 'monitor' is useless without some sort of software to run it.

Assuming it is. (but from the text, sure sounds otherwise)

Given the host names (and appropriate DNS resolution through /etc/hosts or DNS or whatever) of 'workstation' and 'laptop'... if not, replace the machine host names with appropriate IP addresses.

ssh workstation
xhost +laptop

you can then log out of the workstation at this point, as this sets the permissions on the workstation's Xserver to allow 'laptop' to connect.

if you start your programs with the DISPLAY env var set appropriately, you can cause applications to be displayed on the workstation, while running on your laptop.

DISPLAY=workstation:0 xeyes

-or-

export DISPLAY=workstation:0
xeyes

either method will work, the latter causes anything X11 related to be displayed on the workstation when started from that shell. (hope that made sense)

The 'xhost' line is to allow permission for the laptop to connect to the workstation's Xserver. Without it, you'll get permission denied, unless you start the X server with NO permissions, which isn't really recommended. The 'xhost' protection is still lame, as the data is sent 'plain-text' between laptop and workstation and could be sniffed, but it's an easy solution.

If you wanted privacy, you'd need to set up some sort of encrypted tunnel between your laptop and the workstation (port 6000 for display :0). Yup, it gets weird at this point.

If you're in a controlled environment, then using the 'xhost +laptop' command will be sufficient, if you leave of the 'laptop' part of that command 'xhost +', then ANYONE can connect to the Xserver and display things.

Do remember, your mouse is NOT 'connected' to the workstation Xserver, and you will NOT be able to manipulate windows or click on things.

If you want the mouse to be connected, I'd recommend something like x2x, synergy, vnc or an X Windows based screen sharing application.