Home > Linux, Miscellaneous > Accessing a User’s X Session as Root

Accessing a User’s X Session as Root

February 16th, 2010 Leave a comment Go to comments

This is a very simple thing, but it seems not widely known.

You login to, or start, X as a regular user as you rightly should, but you want to be able to su to root and then run a GUI application as root.

There are a number of ways to do this, some better than others, including using “kdesu”, “xhost” etc; the simplest however is:

# xauth merge ~xuser/.Xauthority
# export DISPLAY=:0.0

… where xuser is the user you are running X as. The export line may not be required depending on how you became root.

The root shell you are in now has full authority to communicate with and manipulate X.

Categories: Linux, Miscellaneous Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).