This will ask for the root password:
[Desktop Entry]
Type=Application
Name=Myrlyn
Exec=xdg-su -c /usr/bin/myrlyn
This opens the X11 connection (your display) to everybody in the local network, so use this only in a home network behind a DSL router with nobody else in that network.
Works only with the NOPASSWD
parameter in /etc/sudoers
This uses the sudo
configuration in /etc/sudoers
. For SLES 16.0 / Leap 16.0, this will ask the password of the current user (like in Debian / Ubuntu since forever); in SLE-15 / Leap 15.x, it will ask for the root password (because we have Defaults: !targetpw
in /etc/sudoers
there).
There are rules in /etc/sudoers
that grant the wheel group (see /etc/group
) root privileges.
To be confirmed: In 16.0, the first user account created during installaton is automatically added to the wheel group, so that user account gets those privileges; no root password needed.
[Desktop Entry]
Type=Application
Name=Myrlyn
Exec=sh -c "xhost +; sudo /usr/bin/myrlyn"
Works only with the NOPASSWD
parameter in /etc/sudoers
Same as in section sudo (dirty): No root password needed, first user gets root privileges via the membership in the wheel group.
[Desktop Entry]
Type=Application
Name=Myrlyn
Exec=sh -c "sudo -E DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/myrlyn"
This works only if $XAUTHORITY
is set, i.e. in a local shell on your local desktop, not for ssh -X
, but that should be good enough. This is also why the whole command needs to be embedded into a separate shell (sh -c
); otherwise the .desktop file would only fork and exec the command without a shell around it, and assigning the environment variables wouldn't work.
Alternatively to keep the Qt configuration set with qt6ct
:
Exec=sh -c "sudo -E DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY QT_QPA_PLATFORMTHEME=$QT_QPA_PLATFORMTHEME /usr/bin/myrlyn"
This also asks for the root password:
[Desktop Entry]
Type=Application
Name=Myrlyn
Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/myrlyn
Alternatively to keep the Qt configuration set with qt6ct
:
Exec=pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY QT_QPA_PLATFORMTHEME=$QT_QPA_PLATFORMTHEME /usr/bin/myrlyn
Research needed: Can this also somehow use the wheel group if the user is a member?
- Stack Overflow article about pkexec
- Bug that got this rolling