• NOPASSWD: ALL in sudoers file but still asking for password


    Hey,

    Not really an installation question but I don’t know where else to post it.

    I’ve added myself to group wheel and uncommented the following line using visudo:
    %wheel ALL=(ALL) NOPASSWD: ALL

    I’ve logged out and back in and rebooted even.

    Sudo is still asking me for my password, why is that?

    Thanks!

  • @Injo Ouch :astonished: ! For me, you’ve found a little bug in Antergos, congrats :) .

    Can confirm that freshly installed Antergos behaves as you describe. Continues to ask for password when it should not do that anymore.

    I solved the issue here by removing the file

    /etc/sudoers.d/10-installer
    

    It contains (for my user):

    just ALL=(ALL) ALL
    

    These are sudo settings to ask for password when a command is prefixed with sudo.

    The file’s content doesn’t change even if /etc/sudoers is edited with

    sudo visudo
    

    Without /etc/sudoers.d/10-installer file, sudo visudo returns the expected results:

    • %wheel ALL=(ALL) ALL asks for password

    • %wheel ALL=(ALL) NOPASSWD: ALL doesn’t ask for password

    The native Arch Linux installations here don’t have the /etc/sudoers.d/10-installer file. The /etc/sudoers.d/ folder is empty.

    Regards

  • Thanks for the quick reply.

    Removing the file indeed restores the expected behavior.

    Cheers man! :+1:

  • @Injo Thanks for marking the topic as [Solved].

  • Just wanted to chime in here and state that customizations to the sudoers file should be made using files placed in /etc/sudoers.d. It is considered a bad practice to edit the sudoers file directly. :neckbeard:

  • Double ouch :) ! It’s not a bug but the intended behaviour. I wasn’t aware of this recomendation, and simply followed the Sudo article in ArchWiki.

    I commented out all %wheel instructions in /etc/sudoers with sudo visudo again, created the file /etc/sudoers.d/10-antergos, and placed in it the instruction:

    just ALL=(ALL) NOPASSWD: ALL
    

    It works exactly the same way as /etc/sudoers edited directly. Doesn’t ask for password when sudo is used.

    I think that

    %wheel ALL=(ALL) NOPASSWD: ALL
    

    should work too, though didn’t check that.

    Very elegant way to avoid messing up the sudoers. Antergos devs know well what they’re doing :) !

asking3 nopasswd1 sudoers1 password22 Posts 6Views 763
Log in to reply