Running the desktop under a non-root user

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Post Reply
Message
Author
User avatar
Head_on_a_Stick
Posts: 919
Joined: Sun Mar 17, 2019 3:37 pm

Running the desktop under a non-root user

#1 Post by Head_on_a_Stick »

The Debian stretch release (upon which MX 18 is based) introduced the ability to run the X server as a regular user rather than root:

https://www.debian.org/releases/stable/ ... uires-root

As noted in the link, this reduces the risk of privilege escalation via bugs in the X server.

However, the MX desktop runs the LightDM display manager (login screen) and this runs X as the root user.

To run X as the regular user the GDM display manager could be installed to replace LightDM but this draws in gnome-shell and many other dependencies, which may not be wanted.

Alternatively simply disable the display manager completely:

Code: Select all

sudo sysv-rc-conf lightdm off
Once it is disabled the user will be presented with a TTY (console) login screen and from there the desktop can be launched with

Code: Select all

startx
To automate this (for TTY1) add this line to the end of the file at ~/.profile:

Code: Select all

[ $(tty) = /dev/tty1 ] && exec startx
To apply this configuration for all users on the system, add the line to a file at /etc/X11/Xsession.d/99z-zstartx instead.

If other desktops are installed change between them with

Code: Select all

sudo update-alternatives --config x-session-manager
(The x-session-manager alternative determines what is run when the startx command is passed.)

Note that this method will not work under VirtualBox or if the kernel has no driver that supports your video card.

To revert to LightDM use this command:

Code: Select all

sudo sysv-rc-conf lightdm on
mod note: Signature removed, please read the forum rules

Post Reply

Return to “Tips & Tricks by users”