I'm having an issue on a Ubuntu 20.04 server.
I accidentally commented out all lines in /etc/sudoers.d/username
after reading this thread: https://superuser.com/a/1311042
because I recently noticed that I was able to run sudo apt-get update
without being prompt for the password! Which was super strange for me, because it always asked for the password before.
But before what?
Before I actually play around with ansible stuff, which apparently let it manage this file for running commands without being prompt for a password... something like that (I'm not an expert with that tool, I'm learning how it works actually).
But then by commenting out all lines in the /etc/sudoers.d/username
file, I can no more use any sudo <something>
command! Indeed, it now always says, e.g.:
$ sudo apt-get update
[sudo] password for username: ******
username is not in the sudoers file. This incident will be reported.
How could I get back to the normal behaviour on my Ubuntu user?
%sudo
group entry in the default/etc/sudoers
file then it should be sufficient to add your user back to that group - see for example How do I add myself back as a sudo user? – steeldriver May 07 '22 at 16:56