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

displaylinuxsshxorg

The problem

Most people want to connect to a server over ssh with the "-X" option in order to run GUI programs on the remote host using the display of the client. I would like to run GUI programs on the physical monitor attached to the server. Is this possible ? Let me be more specific:

My situation is the following: I have a workstation without a keyboard or mouse, but it has a monitor connected to it. I would like to SSH to it with my laptop and be able to launch some graphical program, such as xeyes or ssvnc and have it appear on the workstation's monitor.

[xapple@laptop ~]$ ssh workstation
Last login: Mon Sep 26 20:03:35 2011 from laptop
[xapple@workstation ~]$ export DISPLAY=:0
[xapple@workstation ~]$ xeyes
No protocol specified
Error: Can't open display: :0

Edit: extra information

I should maybe explain a few things more clearly:

  • I have sudo access on the workstation, I can install anything if needed.
  • The workstation is running the GNOME user interface.
  • Before disconnecting the keyboard and mouse from the workstation, I logged into a GNOME session. One can therefor see my GNOME desktop on the workstation's monitor currently.
  • I don't wish to run programs from my laptop on the workstation. I would like to run workstation programs on the workstation. The xeyes or whatever executable is found on the remote server and should be run on the remote server's monitor
  • I understand that performing this will leave me in a situation where my cursor will not be connected to the interface. I don't be able to click on things. That's ok.

Any help greatly appreciated !

Best Answer

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
Related Question