0

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?

1 Answers1

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