4

Is it possible to somehow open an x application on another users display?

Say that i have user A who is logged on to the ubuntu desktop, and user B who is accessing the ubuntu machine via SSH.

I know that it is possible for user B to open an x application locally, but is it possible for user B to open a program (ie firefox) and have it displayed on user A's desktop session?

And if yes, how?

Martin Nielsen
  • 359
  • 1
  • 5
  • 15
  • Related: [How to open an application in running X session](http://superuser.com/questions/602865/how-to-open-an-application-in-running-x-session) – slhck Jun 05 '13 at 15:27

1 Answers1

6

Yes, but it will depend on your xhost settings. So, if you have connected as userB to a machine that is running an X session owned by userA, you will need to do two things:

  1. userA must allow you access:

    userA@foo $ xhost +
    
  2. You need to set your DISPLAY variable to the remote display:

    userB@foo $ export DISPLAY=:0;
    

Now userB will be able to run graphical programs.

terdon
  • 52,568
  • 14
  • 124
  • 170
  • And that will make user B's xapp appear on user A's screen? Also, is DISPLAY=:0; the actual value, or do i have to do some reading to find out what to set it for? I would assume i would need to some IP address and user stuff there? – Martin Nielsen Jun 04 '13 at 14:45
  • @MartinNielsen yup. That's what you asked for isn't it? – terdon Jun 04 '13 at 14:46
  • Yes... yes it was:) – Martin Nielsen Jun 04 '13 at 14:47
  • This questions has been asked already see [here](http://superuser.com/questions/602865/how-to-open-an-application-in-running-x-session). Though in a not so clear fashion. Is it possible to merge? Or must one of them be tagged as duplicater? – wottis Jun 04 '13 at 21:29
  • @wottis flag the question for moderator attention and leave them a message with the duplicate's link. They can choose to merge or not. – terdon Jun 05 '13 at 01:53
  • my man entry reports that `xhost +` permits ANY user to use the host X session. The stdout, says: "...clients can connect from any host." Is there a method to specify ONE user only or a add a user to the Set of users? – will Jun 03 '16 at 13:47