Can't use root in Dolphin

Though Plasma devs tried to inhibit execution of certain apps with elevated privileges, all of them are still may by executed as root. These “potentailly dangerous” apps are:

  1. dolphin
  2. konqueror
  3. kate
  4. kwrite
  5. systemsettings5

All of them may be executed as root using pkexec. The syntax is:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch [appname]

where [appname] is the name of 5 application above

Example - starting dolphin as root:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch dolphin

In some distros the use of dbus-launch is not needed. In such a case the syntax is a bit simpler:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true [appname]

If you’re a member of sudo, wheel, another group, and that group is configuraed to execute any command, includig sudo, without askig for password, then dolphin, konqueror, kate, kwrite, systmsettings5 may be prefixed with sudo and started without even asking for password.

The syntax is:

sudo pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch [appname]

Example - starting dolphin as root without being asked for password:

sudo pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch dolphin

Commands may be used in scripts, aliases, .desktop files, keyboard shortcuts, menu entries, etc. to comfortably execute any of them, without typing them in each time they are needed.

7 Likes