Non root Xorg

This page describes how an unprivileged user can run Xorg without using suid.

The logind provider
Currently there are two logind providers in Gentoo, systemd and elogind. Users of systemd profile and users of desktop profiles (both systemd and non-systemd ones) will already have a logind interface provided; users of OpenRC with default profile will be required to globally enable the elogind USE flag and update the system with. It is also required to re-login after elogind has been enabled, to activate it. If either the systemd or elogind USE flag is enabled on x11-base/xorg-server together with the suid USE flag, instead of installing with suid enabled, x11-base/xorg-server will be installed with suid-wrapper, which will only preserve suid if the graphics driver in use really requires root.

The elogind users are recommended to add elogind to the boot runlevel. While it is not strictly necessary, since elogind can be started upon receiving an event over dbus, it will clash with other services that depend on elogind, like fwupd, resulting in OpenRC trying to start already started elogind and thus failing to do so.

dbus service running
It is required to have dbus started so that pam_elogind can start or attach to already started elogind daemon.

Security issues with running xorg-server as root
Several vulnerabilities have been discovered in the X.Org X server. Missing input sanitising in X server extensions may result in local privilege escalation if the X server is configured to run with root privileges. These vulnerabilities can result in an attacker accessing confidential information as well as potentially bypassing protections provided by ASLR.

Cannot start Xorg as regular user
The majority of problems with running Xorg as a user other than root after switching to elogind come down to issues with PAM. One can confirm that elogind is working by running. If it does not work, then one should check:


 * Have the configuration files in /etc been updated after updating the system with the new USE flags?
 * Is there any trace of pam_elogind.so in ?
 * Is the dbus service running?