Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  21] [ 0]  / answers: 1 / hits: 36268  / 1 Year ago, mon, may 29, 2023, 8:58:18

For years, I've had the following in my sudoers file:



scott   ALL=NOPASSWD: ALL


For those who don't know, this prevents sudo and friends (gksudo, etc.) from asking for a password. However, over the years, more and more stuff that once used sudo has been switched to using PolicyKit.



I'm looking for an equivalent configuration for PolicyKit, such that it'll never ask me for my password.



For those who don't like my request, let me say this: I understand the reasons for the default configuration, and they are sound. I also understand the risks inherent in the configuration I want to make. Nevertheless, it's the way I want to set up my system. Those who don't fully understand the above shouldn't attempt what I'm attempting.


More From » password

 Answers
2

You can use the same technique Ubuntu's Live CD uses by tricking PolicyKit and suppressing 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.


[#40792] Tuesday, May 30, 2023, 12 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
algicuade

Total Points: 317
Total Questions: 89
Total Answers: 106

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;