0x0037 - X11 as root

In this guide we go over allowing and setting up ssh as root with X-11 to bring graphical menus.

0x0037 - X11 as root

Sometimes you just need to run an X11 application as root. This guide was fixed and repaired as of May 2025, it was missing images.

Linux disables and mangles  this by default and there is a bit of setup to make it work.  It is considered a security concern, but there may be deep troubleshooting that simply requires it.

  1. Make sure you can even ssh as root. Adjust your /etc/ssh/sshd_config to fit as:
PermitRootLogin yes
PasswordAuthentication yes

Now restart your ssh server:

sudo systemctl restart sshd

a. Make a .Xauthority file as root.  

touch /root/.Xauthority

b. Now try a X11 connection as in:

ssh -X root@<your box>

One of the simplest applications to test for root X-11 is to call xclock

xclock

If you need to set your magic-cookie we recommend this comprehensive and step-by-step guide:

Linux Rocks Every Day