Should I use sudo or policykit for requesting permissions?
[Feature Request] Use `polkit` rather than `sudo`
What's the difference between askpass and polkit? GUI prompt for sudo
Mageia forum • View topic - [SOLVED]gksu aka gksu-polkit vs local sudoers policy
What's the difference between askpass and polkit?
I wanted a GUI prompt for sudo command in a script since the script should be executed from dmenu so there will be no terminal. In the script I have the command sudo systemctl start libvirtd, for example.
At first it seemed like I simply need to install lxqt-policykit (I'm using a Sway window manager so I don't have a desktop environment that probably supports this) and run lxqt-policykit-agent on startup. That seems to have no effect. So I think I think I need askpass program as suggested by sudo -A option. I installed lxqt-openssh-askpass (nearly all askpass programs I've come across mention ssh, not sure if this is appropriate for my usage?) and modified the command to SUDO_ASKPASS=/usr/bin/lxqt-openssh-askpass sudo -A systemctl start virtmanager.
But it still seems failed to work despite actually being prompted for a GUI now. After I input my password I get prompted again for it.
What is most appropriate for my situation and am I missing anything?
Much appreciated.