KDE kdesu can launch app from console but not from Panel icon?

Hello,

I have an app that I launch with root privs using ‘kdesu’.

If I launch it from shell when I’m logged in as a normal user,


    kdesu -d -c "/opt/phpstorm/bin/phpstorm.sh" %f

it works perfectly.

But if I set up a Plasma panel icon with


Properties:
    Application:
        Command"
            kdesu -d -c "/opt/phpstorm/bin/phpstorm.sh" %f

when I click to launch it it tries to start then quites. The system logs show


    Jul 13 18:16:09 jedi.mylan sudo[11259]:  yoda : TTY=pts/4 ; PWD=/home/yoda ; USER=root ; COMMAND=/usr/lib64/libexec/kf5/kdesu_stub -
    Jul 13 18:16:09 jedi.mylan sudo[11259]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Jul 13 18:16:09 jedi.mylan sudo[11259]: pam_systemd(sudo:session): Cannot create session: Already running in a session
    Jul 13 18:16:09 jedi.mylan sudo[11262]:  yoda : TTY=pts/5 ; PWD=/home/yoda ; USER=root ; COMMAND=/usr/lib64/libexec/kf5/kdesu_stub -
    Jul 13 18:16:09 jedi.mylan sudo[11262]: pam_unix(sudo:session): session opened for user root by (uid=0)
    Jul 13 18:16:09 jedi.mylan sudo[11262]: pam_systemd(sudo:session): Cannot create session: Already running in a session
    Jul 13 18:16:12 jedi.mylan sudo[11262]: pam_unix(sudo:session): session closed for user root
    Jul 13 18:16:12 jedi.mylan sudo[11259]: pam_unix(sudo:session): session closed for user root

What do I need to do to get it to launch OK from the icon in the Plasma panel?

I don’t know what info to provide that’s helpful so please just ask.

Thanks.

Rob

If I chage the command in the panel icon


-    kdesu -c "..."
+    xdg-su -c "..."

it works okay.

So it looks like the problem isn’t with sudo rights in general.

Instead something specific to kdesu?

Well, yes, you probably used incorrect options.

Leave out the %f and it should work. %f will be expanded to all selected files in a file manager (doesn’t happen in the terminal of course).

The -c is not really necessary either for kdesu, and you don’t need quotes as there are no spaces.
Actually this would be enough:

kdesu /opt/phpstorm/bin/phpstorm.sh

Removing the %f makes absolutely no difference. Same behavior as I reported with or without the %f.

But it’s still wrong and shouldn’t be there.

And does “kdesu /opt/phpstorm/bin/phpstorm.sh” alone work? (without the quotes)

Btw, xdg-su also just uses kdesu in a KDE session.


kdesu /opt/phpstorm/bin/phpstorm.sh
kdesu "/opt/phpstorm/bin/phpstorm.sh"
kdesu -c "/opt/phpstorm/bin/phpstorm.sh"
etc

all fail exactly as I reported.

Using xdg-su works in all cases.

In your original post,
Your logfile shows that you already have root permissions when you invoked “kdesu” which is what is causing the problem.

Although you’re pointing to your yoda (home?) directory, are you logged in as root?
<Something> is causing your command to run with elevated permissions, perhaps it’s a tick-box in the Panel’s properties to run your command as root?

You need to be a normal User when you invoke “kdesu”

TSU

> Although you’re pointing to your yoda (home?) directory, are you logged in as root?

no

> <Something> is causing your command to run with elevated permissions

Hm. I see that :-/

> perhaps it’s a tick-box in the Panel’s properties to run your command as root?

Nope, I checked.

> You need to be a normal User when you invoke “kdesu”

I know. That’s the point of it. An I’m logged in as my normal user, yoda. On yoda’s desktop, I click the Panel icon there. “As” myself.

And just to repeat, I have NO problems with ANY ‘kdesu whatever’ command if I launch is from Konsole, as myself. Only from the Panel icon launcher.

Then use that.
In the end it should just run kdesu anyway as mentioned.

OTOH, you can just tick the mentioned “Run as different user” option in “Advanced”, and you don’t need to use xdg-su or kdesu at all.

Using kdesu in the command field does work fine here though, I just tried it with a panel icon applet.

Maybe the full content of the icon’s .desktop file would give a clue what’s wrong (I doubt it’s a problem with kdesu itself if it works from a terminal window), you should be able to find it in ~/.local/share/plasma_icons/.