Is there any way to do that? Provided I have ssh access to a machine and I have root on the machine. Can I run xclock for instance in the currently running X (xfce or gnome) session?
Asked
Active
Viewed 3,908 times
0
-
1You'll need `xforwarding` enabled in the `/etc/ssh/sshd_config` (if I recall) and to launch the ssh session with `ssh -X user@host`. Then you can call `xclock &`, though it may take a sec to launch. – nerdwaller Jun 02 '13 at 20:32
-
Like @nerwaller wrote you'll need X11 forwarding. How to use it is described in more detail [here](https://wiki.archlinux.org/index.php/Secure_Shell#X11_forwarding). – wottis Jun 02 '13 at 22:08
-
That is actually something different. I need to run the `xclock` not in my X session (X forwarding), but in the X session that is actually running on the remote machine. To make it simple, I just want to open a browser (for instance) to the person, who is actually operating with the PC I have access and root to. – user1594980 Jun 03 '13 at 14:49
1 Answers
3
You would need to have their xauth token added to your authorization file, and set your DISPLAY accordingly.
First set the DISPLAY variable to the proper X display, since it's the local display it is probably just :0.0 so:
$ export DISPLAY=:0.0
Then import the user's xauth token into yours:
$ xauth merge ~user/.Xauthority
Once you have done that you should be able to run an X client and it will show up on the correct display:
$ xclock &
If your userid has access to the user's ~/.Xauthority then you can do this without being root. But the default permissions for the ~/.Xauthority file is 0600 so likely you'll need to do all this as root.
Hope this helps.
Michael
- 66
- 1
-
Or the user allows him to open programms in his session. Which is answered [here](http://superuser.com/questions/603604/ubuntu-x11-is-it-possible-to-open-an-x-application-in-another-users-session). Is it possible to merge both questions. Because the later one describes it more clearly or should it be tagged as duplicate instead? – wottis Jun 04 '13 at 21:23