Using x after sudo su –

As first logged in user, type: xauth list
Gives something like
servername:11 MIT-MAGIC-COOKIE-1 b5d6725cd2be54e6b681b8fe5e4d4702
servername:12 MIT-MAGIC-COOKIE-1 e2ed6b2ebcaf1b2cde22b75085e6ee17
servername:10 MIT-MAGIC-COOKIE-1 1ead678498951862eca4775f1936e3e5

Type: env | grep DISPLAY
Gives
ipaddress:10:0
Note :10, so use the magic cookie for :10 (last line in this example)

Sudo su –
export DISPLAY=ipaddress:10:0
Type
xauth add servername:10 MIT-MAGIC-COOKIE-1 1ead678498951862eca4775f1936e3e5

And type xclock to verify.

Leave a Reply