How do I prevent PolicyKit from asking for a password?

You can trick PolicyKit and suppress ALL password prompts by substituting the action with a wildcard.

DISCLAIMER: The following will suppress ALL password prompts globally for everyone belonging to the admin group, with the exception of the login screen. It is EXTREMELY dangerous and should NEVER be implemented because chances are YOU WILL END UP BREAKING YOUR SYSTEM!!

Don't say you weren't warned!

NOTE: If you are running 12.04 or later, substitute "admin" with "sudo"!

Replace "username" with your actual user name:

usermod -aG admin username

Switch to root:

sudo -i

Create a new policy:

gedit /var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla

Add the following:

[Do anything you want]
Identity=unix-group:admin
Action=*
ResultActive=yes

Save and exit. Then go try something that usually requires a password. :)

NOTE: It doesn't matter what you use as your .pkla file name. You can name it anything you want.

And last, this is the ONLY policy you'll need when it comes to suppressing password prompts because again, it does so globally.


You can create a .pkla, either an all in one or a couple based on action groups, doesn't really matter.

For reference look in /usr/share/polkit-1/actions, open interested ones in a text editor to get action id's.

As far as a .pkla or 2 I find the best place to put them is here, it will be protected from any updates

/var/lib/polkit-1/localauthority/50-local.d

So for example here is my main one, named package-manager.pkla though it extends a bit further than just package management policy's

[Install package file]
Identity=unix-group:admin
Action=org.debian.apt.install-file;org.debian.apt.update-cache;org.debian.apt.install-or-remove-packages;org.debian.apt.upgrade-packages
ResultActive=yes

[Install package synaptic]
Identity=unix-group:admin
Action=com.ubuntu.pkexec.synaptic
ResultActive=yes

[Change add repo]
Identity=unix-group:admin
Action=com.ubuntu.softwareproperties.applychanges;org.debian.apt.change-repository
ResultActive=yes

[usbcreator format]
Identity=unix-group:admin
Action=com.ubuntu.usbcreator.format
ResultActive=yes

[Install bootloader]
Identity=unix-group:admin
Action=com.ubuntu.usbcreator.bootloader
ResultActive=yes

[Add users]
Identity=unix-group:admin
Action=org.freedesktop.accounts.user-administration
ResultActive=yes

Note that starting in 12.04 the group used for "admin" user should be changed to sudo, ie.

Identity=unix-group:sudo

Also note that actions can be strung together per section, no spaces, use a ; in between id's