How to avoid a GUI application to prompt for root password
If you want an application that needs root permissions to ask for your user password instead for root password, you can create a polkit rule.
You probably use sudo
to execute a command with root permissions. You can achieve the same on GUI applications with Polkit. By default, a graphical app that requires root permissions will prompt you for root password unless your user belongs to ‘wheel’ group. You can add a Polkit rule to include ‘sudo’ group to the administrator identities (you can also include your user to ‘wheel’ group if you prefer).
You need root permissions to follow these steps:
- First, ensure that
polkit
is installed. - Go to
/usr/share/polkit-1/rules.d
and copy50-default.rules
to a new file called40-default.rules
(you can use another name as long as you use a number less than ‘50’ at the beginning and keep the ‘.rules’ suffix).cp 50-default.rules 40-default.rules
- Edit the new file and change
wheel
forsudo
at the end.polkit.addAdminRule(function(action, subject) { return ["unix-group:sudo"]; });
- Save the file.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: