I recently switched to OpenSUSE Tumbleweed. Overall, I’m impressed, but I’d like to be able to lock down the root account and use my own password to elevate privileges (like most other distros). So far, I’ve been very successful. I’ve edited the sudoers file to allow anyone in the wheel group to use sudo with their own password. I added a polkit rule to allow anyone in the wheel group to authenticate to the polkit.
The problem, however, comes when I try to open YaST. I’ve looked at this GitHub issue, which describes how to set up a polkit policy for YaST. I copy and pasted that policy into a file. For reference, here’s what that file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.freedesktop.policykit.pkexec.YaST">
<description>Run YaST</description>
<message>Authentication is required to run YaST</message>
<icon_name>yast-control-center</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/sbin/yast2</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>
I then changed the .desktop file for YaST to use pkexec. To my amazement, it worked. On KDE Plasma. I then tested it on Hyprland (I may be switching to Hyprland in the future), only to find that it does not work. Even when I make sure I have a polkit running (I’ve tried hyprpolkitagent and polkit-kde-agent), wofi just will not launch YaST this way. When I try, nothing happens.
The closest I’ve come to making this work comes from reading the Arch Wiki page on running GUI applications as root. I’ve edited the .desktop file yet again to include:
Exec = pkexec env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/run/user/0 /sbin/yast2
That command works on the terminal, but still not through wofi. When I tell wofi to launch YaST, still, nothing happens. I’ve also tested on GNOME and OpenSUSEway, with the same results; I can launch YaST on GNOME, but not on OpenSUSEway.
Can someone point me in the right direction? Why can I launch YaST with pkexec on KDE Plasma but not on Hyprland (via wofi)?