Launcher to run script with elevated permissions
-
Dear All,
I have created a desktop file in
~/.local/share/applications/
to run a script of mine with elevated permissions. This is the important part:
Exec=env SUDO_ASKPASS=/usr/bin/systemd-ask-password sudo -A /usr/bin/bash /home/phablet/path/to/my/script.sh
Unfortunately, when I launch this, I am not asked for my password and in the logs, it says:ubuntu-phablet bash[29466]: Failed to query password: Permission denied
In the terminal, the same agent works for me, e.g. as inSUDO_ASKPASS=/usr/bin/systemd-ask-password sudo -A id
. But there, it uses the terminal itself to ask for my password, while in the case of my launcher, I would need a GUI for the same.
Can anyone help me with this? -
-
I suspect now that this might be the reason: Please let non-root users ask for passwords. Anyway, I cannot see, how the suggested workaround could be implemented in my case, also given that there's no
setfacl
command on UT... -
@Babber you will probably want to write a QML / C++ wrapper around your scrips, to do what you want. See the Terminal app source code for an idea how to do that.
-
@arubislander OK, thank you, I'll have a look at it and consider this option. Cheers