I want to run Linux desktop (xfce, lxde, ...) only as root,
while denying accessing to other users.
Only the root (admin) has the privilege to run a desktop environment or a GUI application.

We can suppose the same situation for another user. What I mean, if there is a way to run the full GUI (Desktop Environment, Browser, File Manager, ...) ONLY through one user ?

  • Welcome to superuser. Keep asking questions - after doing some research around Google first. These questions and answers are how stackexchange is built. – SDsolar Apr 8 '17 at 1:08
  • 1
    It's general considered good practice to never run a Linux desktop as root. The reason is to reduce complexity: the fewer programs you run as root, the fewer things can go wrong. Instead, what you do is to give on particular user (which can be named "admin", say, while the real root is "root") root access via sudo, and then this user can execute commands via sudo as necessary. – dirkt Apr 8 '17 at 16:02

Don't see a question in the OP. But it is not difficult to use your favorite GUI editors in su mode.

For instance, I use vi a lot, and it easy enough to just type this in terminal:

sudo vi filename

This will work for leafpad, nano, etc. Leafpad will not start if you are logged n via PuTTY, but vi and nano work fine. If you are logged in with the GUI and open a terminal window then su leafpad will work fine, too.

Just don't expect this to work in file explorer unless you have direct permissions to the file or directory.

  • sorry for the title, I updated it. – Baron Leonardo Apr 7 '17 at 19:03
  • you miss understand my question. I want to run the whole desktop environment ONLY as root. – Baron Leonardo Apr 7 '17 at 19:03
  • Obviously you can simply log in as root. But that certainly is not recommended. It is always a good reminder to need to type sudo when working on parts of the system that can affect more than just your home directory files. If you stay logged in as root all the time then you can enter commands like rm -r / and Linux will happily go about destroying your system without complaint. – SDsolar Apr 8 '17 at 1:04

The most simple method would be to disable graphical login manager service and limit user access to graphical interface binaries by changing permissions. Your users would login on TTY. Root would be able to start desktop environment by manually executing a command after login.

Now the exact method how to do this depends on your software choices - at the very least on these:

  1. Your init system (usually determined by Linux distribution and version)
  2. Your graphical login service (GDM, KDM, Slim ... )
  3. Your graphical interface provider (X Windows System, Wayland ... )

Edit: However I have yet to encounter use-case, when running desktop as root would be a good idea. It is a potential security risk. Bear in mind that most of GUI applications aren't even written for this kind of use - to be permanently running as root.

  • I think he means that only the root user can run desktop environnement, not that the desktop would run as root. – Taz8du29 Apr 7 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.