Bug 374706 - starting a bash-script as "root" by clicking desktop-file fails
Summary: starting a bash-script as "root" by clicking desktop-file fails
Status: RESOLVED WORKSFORME
Alias: None
Product: frameworks-kinit
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.29.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-07 18:38 UTC by MaxiPunkt
Modified: 2022-12-23 05:23 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MaxiPunkt 2017-01-07 18:38:53 UTC
Hi there,

starting a bash-script by clicking on a desktop-file (which opens a new "konsole" terminal on my system, then) as ordinary user is just fine.

But if I want to do the same with UID-substitution functionality (the bash-script shall be run as user "root") the execution of bash-script fails.

UID-substitution is defined directly inside the desktop-file (or within KDE-properties of the icon). Like this one is asked to authenticate (password) and the script will be executed inside a new opened "konsole" terminal, then.

As described this worked for me for years (in particular I was using backup-script which has to be run as "root"), now this is broken for a while already.
It was introduced approx. mid of 2016 with some system-updates (in that times I was still running Fedora 23). Unfortunatelly I can't name these updates exactly, sorry.

Now being on Fedora 25, I additionally get the error-message saying "kinit5" crashed. If my bug should not be related to "kinit5" but another component of KDE please let me know.


Content of example bash-script:
-------------------------------
#!/bin/bash
echo -n "I am: "
whoami


Content of example desktop-file:
--------------------------------
[Desktop Entry]
Comment=A simple script for test proposes
Exec=/path/to/above/script/test.sh
GenericName=Bash script
Icon=application-x-shellscript
MimeType=
Name=My-Terminal-Script
Path=
StartupNotify=false
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
#X-KDE-SubstituteUID=true
#X-KDE-Username=root


Running the script above by clicking the icon works fine.
After uncommenting the last 2 lines (enables UID-substitution) it will fail.
Comment 1 Olaf Meltzer 2017-01-15 11:21:54 UTC
I confirm this bug.

This bug is not related tu su root alone, but to any change of the executing user.

Testcase is openSUSE 42.2 (x86_64), Kernel 4.4.36-8-default, KDE: 4.14.25.

This Bug is not present in openSUSE 42.1.

Olaf Meltzer, 2017-01-15
Comment 2 Olaf Meltzer 2017-01-15 17:58:32 UTC
Erroniously I wrote, the bug appears under KDE: 4.14.25.
This is wrong. Actually I use KDE: 5.26.0 Plasma 5.8.3

Sorry for my mistake
Comment 3 Olaf Meltzer 2017-03-14 15:48:29 UTC
After latest Updates of KDE-related packages with Plasma now in version 5.8.6 the Problem disappeared.

openSUSE Leap 42.2 - Kernel: 4.4.49-16-default
Qt: 5.6.1 - KDE Frameworks: 5.26.0  - Plasma: 5.8.6

Olaf
Comment 4 MaxiPunkt 2017-03-14 21:16:08 UTC
Nope, on my system (FC25 / KF 5.32.0 / plasma 5.8.6) bug is still present.
Comment 5 Justin Zobel 2022-11-03 01:39:54 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 6 Bug Janitor Service 2022-11-18 05:15:13 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 7 MaxiPunkt 2022-11-23 16:02:59 UTC
Up to now I worked around the problem by coyping the files to:
usr/local/share/applications/*.desktop
/usr/local/bin/*.sh

Like this I was able to execute the script as root.


Don't have most recent software version, but now tested again with:
plasma 5.25.4
frameworks 5.96.0

desktop file again was placed in: ~/Desktop


Now there initially is a new dialog box showing up to choose if I trust in the script or not.
If I confirm to go on, then the script is executed and everything works as expected now.

Someone seems to have fixed this issue.
Comment 8 Bug Janitor Service 2022-12-08 05:13:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Bug Janitor Service 2022-12-23 05:23:25 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!