[LINUX] Avoid passwords for all apps with PolKit

Even if you bypass password authentication with sudoers, Polkit authentication cannot be bypassed, so a memo for that I often see "only some apps", but there was no way to apply it to all, so I made it myself.

Write the following code in /etc/polkit-1/rules.d/49-nopassword.rules.

Avoid all authentication

polkit.addRule(function(action, subject) {
    return polkit.Result.YES;
});

Avoid authentication for specific groups only

[ArchWiki](https://wiki.archlinux.jp/index.php/Polkit#.E3.83.91.E3.82.B9.E3.83.AF.E3.83.BC.E3.83.89.E3.83.97 Quoted from .E3.83.AD.E3.83.B3.E3.83.97.E3.83.88.E3.81.AE.E8.BF.82.E5.9B.9E)

polkit.addRule(function(action, subject) {
    if (subject.isInGroup("sudo")) {
        return polkit.Result.YES;
    }
});

bonus

Of course, there is no security at all, so we recommend that you do not use it except in special environments. This "Avoid all authentication" was used in a live environment of DVD booting.

Recommended Posts

Avoid passwords for all apps with PolKit
Tips for developing apps with Azure Cosmos DB in Python
Create a social integration API for smartphone apps with Django