Some times we haven’t access with root user directly to a server and we need execute su – to scale up to root. When we do we lose X connection but we can perform the following steps to run applications XWindow:

1.- Connect to server and list enviroment variables and xauth

Connecting to…

Connection established.

To escape to local shell, press ‘Ctrl+Alt+]’.

Last login: Mon May 23 11:22:22 2016 from

johnd@JohnD-Server1:~> echo $DISPLAY


johnd@JohnD-Server1:~> xauth list $DISPLAY

JohnD-Server1/unix:10  MIT-MAGIC-COOKIE-1  70a56a2cb6e8d74cfefc29c1b6186efb

2.- Change to root user:

johnd@JohnD-Server1:~> sudo su –

3.- Set the variable and xauth

JohnD-Server1:~ # export DISPLAY=localhost:10.0

JohnD-Server1:~ # xauth add JohnD-Server1/unix:10 MIT-MAGIC-COOKIE-1 70a56a2cb6e8d74cfefc29c1b6186efb

Enjoy it

Juan de la Cruz Arellano Royo

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Nelis Lamprecht

    Just a tip for the above post. You can also use the following command as root to add the “magic cookie” from a X user:

    xauth merge ~user/.Xauthority

    Less work 😉




Leave a Reply