14

I'd like to know how I can disable the authentication prompts when opening apps such as Synaptic, mounting disks and so.

I got my user as passwordless set in sudoers, but seems the change to systemd changed something and now I keep getting prompted. Is there any way to set it like sudo in /etc/sudoers so my user can open such apps unprompted?

I am aware of the security risk, but this computer is not connected to the internet and no one else has access to it, I am aware of the safety risk, but I want to do this anyway, for convenience.

3
  • 1
    Does this answer your question? How do I prevent PolicyKit from asking for a password?
    – Daniel T
    Feb 20 at 16:49
  • @DanielT I voted to leave this question open because I think it's a better question than the duplicate question that you linked to.
    – karel
    Feb 21 at 8:20
  • @karel The other one was older but if you want you could vote that one as a duplicate of this one
    – Daniel T
    Feb 21 at 9:18

1 Answer 1

27

As I understand it, these prompts use Polkit, not sudo, for authorization. Therefore, setting NOPASSWD in sudoers won't make any difference to it. To make Polkit skip password prompts, create a .pkla file in /etc/polkit-1/localauthority/50-local.d/ (say /etc/polkit-1/localauthority/50-local.d/99-nopassword.pkla) containing:

[No password prompt]
Identity=unix-group:sudo
Action=*
ResultActive=yes

See the pklocalauthority manpage for more information.

11
  • 1
    That's great, works as expected. Thanks a lot!
    – plasmating
    Apr 27, 2015 at 0:02
  • For some reason created pkla file is not working on my system. I have polkit 0.105 and 18.04. How to debug what is wrong?
    – Suncatcher
    May 6, 2018 at 9:07
  • @Suncatcher afaik nothing significant has changed for Polkit in 18.04 (we're still well behind upstream 0.114 or the 0.112 release that include JavaScript rule definition support). Please post a new question with the exact filename and contents. You can leave a comment here when that's done, so I can take a look.
    – muru
    May 6, 2018 at 9:13
  • created, but on 18.04 I have old 0.105 polkit.
    – Suncatcher
    May 6, 2018 at 9:37
  • 1
    No luck for me in 22.04 ubuntu. echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER this command will work for me
    – NIrav Modi
    Jul 27, 2022 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .