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

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?


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.