‘sudo’ stopped working!

I wanted to do some maintenance and found out that my login cannot do sudo anymore.  This can be very disturbing.

luser:~$ sudo apt-get update
[sudo] password for luser:
luser is not in the sudoers file. This incident will be reported.

Report all you want, my login was part of sudo till a day ago. What changed?
Before you think of any intrusion, try to remember if any group ownership changes were done. If so, then that likely led to removal of user from sudoers file.
Luckily, I had done some changes and added a group:
usermod -G without the -a flag. Remember “-a” is needed, as it appends to existing groups, or you will get kicked out all of them.

So the fix this is to edit sudoers file or run usermod -a admin
To do so, I had to start the server in single user mode and drop to root shell. It’s a bit of a pain in Ubuntu. I prefer to run:
usermod -a admin

Leave a comment

Your comment