Sudoers File: Passwordless terminal issue

zypper dup

Anyone any other ideas?

Defaults targetpw   # ask for the password of the target user i.e. root
ALL   ALL=(ALL) ALL   # WARNING! Only use this together with 'Defaults target

commenting out these seems to have fixed the issue

The first would change it so you used your password instead of the target user’s password.

The second, though, shouldn’t make a difference.

In any event, glad you got it sorted out. :slight_smile:

It most certainly should because the last matching entry wins. But as OP never bothered to either explain what was done so that others could also understand it nor show the actual configuration nobody could guess it (or, better, it could only be a guess, one of many).

This was news to me. Thanks for taking the time to explain this.

I had assumed, based on how other tools that I use work, that it stopped at the first match. But a quick test shows that this is in fact correct - and that I should not have made a bad assumption. :slight_smile:

And even in this case the effect of modifications depends on where exactly in the configuration file(s) the new entry is added. And that was never described.

What was I meant to show.? I pasted the whole sudoers file and said what I commented out to make it work

In which post can I find it? I browsed through the thread, but stupid me did not see it, only a few lines that may be parts of it.
But not a complete cat ... with all output up to and including the next prompt to show it is complete.

What was I meant to show.? I pasted the whole sudoers file and said what I commented out to make it work. What did I miss?

I did post earlier but appears that link is no longer valid

It seems indeed that the suggestion lacked a “time to keep”.
-e 40320 would have been better then the default 30 minutes.

My personal advice is to never run suggested commands when you did not check what it does. These forums are not full of mean guys, but people here also make errors and typos. Thus a quick check isn’t bad (and can teach one a lot). In this case

man susepaste

is your friend.

1 Like

No, I looked during the available time, but the link wasn’t valid - I was not in a position to follow-up when I looked at it. I was unaware that paste.opensuse.org was/is having an issue.

OP attempted to share it as requested, but something didn’t work right.

In any event, his issue is now solved, so there’s no point in continuing a back and forth about what was/wasn’t provided at this stage.

I don’t think so.

The problem is that the first match is relevant.

Ok, it’s not working again, here’s my sudoers:

This is not some kind of mystery. I already posted what you should do. Having the sudoers file entirely in /etc is not the way. I can add / remove NOPASSWD to my liking from my file in /etc/sudoers.d, it instantly works.

So I create another file in/etc/sudoers.d or make a duplicate file?

I completely am losing track now. This is what I would do:

  • sudo rm /etc/sudoers
  • sudo echo "spaceboy ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/spaceboy

This would give you the same config as I have, which has been working for ~4 years without any issues.

1 Like

What part of “sudo is using the last matching rule from sudoers” you do not understand?