Authorizing administrative tasks as non-root user in GNOME

Anyone using GNOME has probably seen this screen at some point:

GNOME asking for authorization

If this dialog asks you for your user password like in the screenshot above, it's already working "correctly" (as in, "as we want it to work in this post").

However, on some Linux distributions like Arch Linux for example, this is not the default. Instead, it will ask for the password of your root user. Personally, I don't set a password for root and instead set up and use sudo for command line tasks that require root privileges.

Polkit

In GNOME, the service responsible for authenticating and elevating permissions for certain tasks is called Polkit ("Policy Kit").

Adding an admin rule

Now we need to tell Polkit to allow all users, who are in a certain UNIX group, to do administrative tasks. This is done by adding a new rule to Polkit:

sudoedit /etc/polkit-1/rules.d/50-admin.rules

This rule states that all users in the UNIX group sudo should be treated as administrators. Change the group name to fit your setup (e.g. if your admin group is called wheel)

50-admin.rules
polkit.addAdminRule(function(action, subject) {
    return ["unix-group:sudo"];
});

Reloading Polkit

After adding the rule, restart Polkit to load your new rule:

sudo systemctl restart polkit.service
Timo's Blog