1

I am connecting to a Linux CentOS 2.6 computer via SSH wit the display deported on my screen (using MobaXterm). It is also possible to access to this computer "physically".

However, I would like a way to inform people that may want to access "physically" to the computer that I am currently using it via SSH.

One way would be for them to make who in a terminal and see whether someone is connected from another computer. However, I don't want them to have to check this manually each time (they may - and will - forget this check).

Thus, I would like a way to open a window on THEIR display (i.e. the screen plugged to the computer) with a message for them. Somthing like a text into gedit would do the work.

Can I do that? Can I open an application on a different display than mine?

Anthon
  • 79,293

1 Answers1

1

Can I do that? Can I open an application on a different display than mine?

Yes, if you have the appropriate permissions. For example, on a desktop where you are the only current user with a GUI, try switching to a console (e.g., via alt-ctl-F4), log in as the same user, and try:

xterm -display 0:0

Your mileage may vary with regard to the display id (see comments), which is actually a network address. Presuming xterm is installed and there are no errors (note this is a foreground process, so don't ctrl-c or otherwise interrupt this from the console), you should now be able to switch back the GUI and find an xterm floating somewhere.

Most GUI applications should accept this -display option. You can do the same thing via ssh. If there are multiple X servers running, the displays are usually numbered starting with 0:0, then 0:1 -- at least, that's how they are if they are all using the same physical card and monitor; I'm not sure how it works if you have multiple X servers running simultaneously connected to separate physical displays (perhaps 0:0, 1:0,...).

Again, note that you need appropriate permissions to do this. The superuser can start an application on anyone's display, but if you are just normal user bob, you will not be allowed to launch something on normal user sue's desktop.

You can also start an X server via ssh and launch applications on it this way.

goldilocks
  • 87,661
  • 30
  • 204
  • 262
  • Thanks for the answer! Is has worked, but I had to type the command xterm -display :0.0 instead of xterm -display 0:0 you answered. I'm not sure if it is a typo or if there is a difference (looks like a typo to me). – Laurent C. Apr 08 '14 at 15:20
  • -display 0:0 works for me on a local console -- and in fact, :0.0 fails with a "No protocol" error. Lo and behold, it's actually a network address...there's a great discussion of that here; I've edited a link to that into the answer too. – goldilocks Apr 08 '14 at 15:44
  • Ok I'll check that! Thank you again for your help here :) – Laurent C. Apr 08 '14 at 15:53