MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post Reply
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post by dancytron »

tl;DR

Unzip the attached file, paste the files from /etc into their respective folders, create a user called "superuser" in the MX Utility for that purpose with sudo and the obvious default settings (it will automatically create a "superuser" group), and enjoy not retyping your password over and over again no good reason for everything but gparted and maybe a few other things I missed.


Longer explanation.

I've resisted the temptation to use dog themed names.

There are 2 sets of 3 files files for 2 user groups, "superuser" and "owner" in /etc that actually do anything.

/etc/sudoers.d/owner - owner group doesn't have to type password for sudo. example for individual apps commented out
/etc/sudoers.d/superusers - superusers group doesn't have to type password for sudo. example for individual apps commented out

/etc/polkit-1/rules.d/30-superuser.rules - superuser group doesn't have to type password for pkexec actions that have mx or pkexec in the title
/etc/polkit-1/rules.d/31-owner.rules - owner group doesn't have to type password for pkexec actions that have mx or pkexec in the title, except almost all commented out
/etc/polkit-1/rules.d/35-moresuperuser.rules - a few more actions with gparted commented out
/etc/polkit-1/rules.d/36-moreowner.rules - a few more actions with gparted commented out

There are short comments in each file and readme files on how they were created.

There are 3 screenshots attached. Hopefully they will substitute for writing a long explanation.

SuperUserFilesSmall.jpg shows the 2 folders in /etc and superuser sudoer file and .rules file format.

MakeSudoLauncherSmall.jpg shows a password prompt for pkexec that has pkexec itself as the action. I think you need to either type your password or use sudo instead. Adding polkit itself to the .rules file doesn't work.

PkexecActionExampleSmall.jpg has a lot going on. The bottom left is the output from "pkactions --verbose". What we are doing is changing where it says "implicit active = auth_admin" from "auth_admin" to "yes". There also some that say "auth_admin_keep" changed to yes(?? probably should double check that eventually).

The original list of actions is generated by

Code: Select all

root@mx1:/home/superuser/Desktop# pkaction
com.hp.hplip.installplugin
com.ubuntu.pkexec.gufw
com.ubuntu.pkexec.lightdm-gtk-greeter-settings
com.ubuntu.pkexec.synaptic
<and so on>

In Debian distro's, you can have local .desktop files override the ones in /usr/shared/applications by putting them in /home/username/.local/shared/applications. So you can make a sudo version the menu default by adding sudo to the "exec=" line and copying it to .local/shared/applications. Use a different file name and both will appear. MX puts .desktop files directly in /home/username/Desktop and you can do that with launchers with sudo added too.

@dimkr How bad is it?

SuperUserFilesSmall.jpg
SuperUserFilesSmall.jpg (124.5 KiB) Viewed 408 times
MakeASudoLauncherSmall.jpg
MakeASudoLauncherSmall.jpg (92.72 KiB) Viewed 408 times
PkexecActionExampleSmall.jpg
PkexecActionExampleSmall.jpg (104.12 KiB) Viewed 408 times
dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post by dancytron »

EDIT: If anyone wants the files, DM me. I'll put them back after I go through the list knowing more.

Last edited by dancytron on Fri Jan 26, 2024 2:26 pm, edited 1 time in total.
Clarity
Posts: 3270
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1347 times
Been thanked: 438 times

Re: MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post by Clarity »

Hello @dancytron Nice work in designing these upgrades to make user use simple.

I wonder if @amethyst NicOS utilties will allow you to generate a remaster with all of your changes as an OOTB ISO for forum release?

dancytron
Posts: 653
Joined: Fri Dec 13, 2019 6:26 pm
Has thanked: 422 times
Been thanked: 190 times

Re: MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post by dancytron »

Clarity wrote: Sun Jan 21, 2024 4:55 am

Hello @dancytron Nice work in designing these upgrades to make user use simple.

I wonder if @amethyst NicOS utilties will allow you to generate a remaster with all of your changes as an OOTB ISO for forum release?

MX has it's own remaster program, but it would 2 gig to distribute 6 little text files.

A script to make the list with the "pkaction" command in the correct format for the .rules file with a comment for each saying what the default setting is so you can intelligently decide what should get the no password treatment seems like a doable next step. Right now the "superuser" list is really just guess based on the name of the action.

User avatar
wizard
Posts: 1586
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: MX Linux (and other Debian distros) Getting rid of the password prompt for sudo and pkexec

Post by wizard »

@Clarity

wonder if @amethyst NicOS utilties will allow you to generate a remaster with all of your changes as an OOTB ISO for forum release?

No, since it is not a Puppy.

MX Linux is MUCH larger than Puppy, even using their frugal install (smallest install type) it is 4-5gb. Puppy's compact size has always been a tribute to our developers. We get more usability per pound than any other Linux out there. :thumbup2:

Would the Puppy forum even be a good place to distribute it?

wizard

Big pile of OLD computers

Post Reply

Return to “Other Distros”