How to override polkit password prompt in pamac?

I have an system-setup-and-update script that sets up some stuff in the OS and runs pamac a couple of times. I know that running pamac with sudo is out of the question, since I use it to sync AUR packages.

Can I setup polkit so that it won’t prompt me for passwords? I want to just input my password once when I run the script. Ideally, that exception would only be active when I’m running the script; normal pamac use should still prompt for password.

If running my script from a different user would do it, then I’d like to set that up. But again, I’d need to configure polkit so that I don’t always get prompted to choose the user when running pamac (it’s really annoying when I have multiple users).

pamac use polkit

yes you can edit before/after (with sudo) rule in script. View polkit doc and /usr/share/polkit-1/rules.d/

Alright, I have a working solution.

I add /etc/polkit-1/rules.d/99-pamac-override.rules with this contents:

polkit.addRule(function(action, subject) {
    if (action.id == "org.manjaro.pamac.commit" && subject.isInGroup("butla")) {
        return polkit.Result.YES;
    }
})

When I add the file polkitd reloads the rules, which can be observed when running systemctl status polkit.service.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.