Ubuntu X11: Is it possible to open an X application in another users session

4

1

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

Posted 2013-06-04T13:42:00.117

Reputation: 347

Related: How to open an application in running X session

– slhck – 2013-06-05T15:27:05.130

Answers

5

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

Posted 2013-06-04T13:42:00.117

Reputation: 45 216

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 – 2016-06-03T13:47:00.343

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 – 2013-06-04T14:45:24.623

@MartinNielsen yup. That's what you asked for isn't it? – terdon – 2013-06-04T14:46:22.850

Yes... yes it was:) – Martin Nielsen – 2013-06-04T14:47:13.443

This questions has been asked already see here. Though in a not so clear fashion. Is it possible to merge? Or must one of them be tagged as duplicater?

– wottis – 2013-06-04T21:29:57.597

@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 – 2013-06-05T01:53:26.533