Home blog View Post
Smart Blog
Having trouble with Xephyr as root? Here's the solution

Sometimes it could be useful to run Xephyr as root, but something unexpected may happen.
For example, this could be a common problem:

# Xephyr -ac :1
No protocol specified

Xephyr cannot open host display. Is DISPLAY set?

The solution is to log in as a normal user and issue the following command:

# xauth list

You will get something like this:

VDDServer/unix:0  MIT-MAGIC-COOKIE-1  34tf17yt938rddd324j37b9a09e66445

Now, login as a root user and perform the following command:

# xauth add VDDServer/unix:0  MIT-MAGIC-COOKIE-1  34tf17yt938rddd324j37b9a09e66445

A new .Xauthority file will be created and it is now possible to run Xephyr as root.

By: Flavio Bertini On Wednesday, 28 October 2009 Comment Comments( 3 ) Hits Views(20697)
Comments The MIT-MAGIC-COOKIE-1 code changes...

Unfortunately, that is not a permanent solution.

Actually, the code after MIT-MAGIC-COOKIE-1 changes at each user login, so that the procedure has to be done every time. Of course, a very small script could be useful to do all things automatically.

By: Flavio Bertini , On Friday, 30 October 2009
Comments New and quick way to launch Xephyr as root

Here again.

Launching Xephyr as root maybe rather boring since we have to do with xauth. But what can we do if we need to launch Xephyr several time in the same work session without doing the same procedure described above?

The solution is pretty easy. I found a method to run Xephyr very quickly getting rid of the permission issues. Just perform the following command and Xephyr will be launched for you without any boring message.

sudo su - -c "xauth merge $HOME/.Xauthority;export DISPLAY=:0.0 && Xephyr -ac :1"

In this way, the user permissions will be automatically exported to the root user, that will be able to run Xephyr.

By: Flavio Bertini , On Thursday, 12 November 2009
Comments sux! Another solution

Another great solution to this problem can be the use of the sux application.

sux is a "su" wrapper which transfers X credentials.

Further information at http://fgouget.free.fr/sux/sux-readme.shtml

By: Flavio Bertini , On Wednesday, 19 October 2011