Is possible (by root of course) to run a command from console, that will be executed on X-session owned by another user on the same linux box/machine ? Example: Can root open xclock for another local user logged into X11 ?

2 Answers 2


if the use haven'T protected his X session, it should be possible for any user on any network that X is listening to use the X server.

DISPLAY=$host:$displayNum xclock


You would need to set the DISPLAY environment variable to that user's X display, or invoke the command with a -display DISPLAYNAME argument.

You may also need to ask the other user to grant you permission to use their display using the xhost command:

xhost +yourname


xhost +yourhost

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .