Sudo -s no password prompt?

Hello!

This isn’t really a bug or feature request, more of a how did you do that?

On any QuickBox build, I’m never prompted for a password for sudo commands.

How did you accomplish this? is there some magic in the sudoers file that allows you to have users escalate without password?

I only ask because I have other machines I’d love to use this feature with

It’s in the /etc/sudoers file.

User privilege specification

my_user ALL=(ALL:ALL) NOPASSWD: ALL

now if the user is a member of sudo group then the above is overwritten and it still prompts. The file is read from the top down so it’s granted the no password via above but then later in the file it hits this:
%sudo ALL=(ALL:ALL) ALL

Which says anyone in the sudo group has ‘all’ but is still prompted for passwords. The fix is to either comment out the %sudo line OR remove the sudo group from my user.

One final edit: I find that if I install my OS and specify my master user during OS install that its automatically added to the sudo group…so now I use that same user for QB setup and boom. I’m always prompted. I will remove my master user from the sudo group to fix it.

1 Like

Hey bud,

thanks for this.

I’ve added
valkyre14 ALL=(ALL:ALL) NOPASSD: ALL
under user privilege escalation section (above the sudo ALL part)

It’s still prompting for a password, but it’s probably something to do with the order I have the options in. I’ll figure it out :slight_smile:
Thanks for telling me where to look!

what does “id valkyre14” say?

uid=1000(valkyre14) gid=1000(valkyre14) groups=1000(valkyre14),27(sudo)

should I remove the user from the sudo group?

yeah:
sudo deluser valkyre14 sudo

This will remove you from the group.

It’s that entry later on in the /etc/sudoers thats doing it. Its in there by default on every debian based system I’ve seen.

perfect!
worked a treat.

Another entry in my “handy ubuntu tricks” text file :smiley:

Appreciate you taking the time to answer!