Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

{Solved} Sudoer broken Debian 11 - Resolved on my own but decided to post for future questioners

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
yodamin
Posts: 23
Joined: 2022-10-03 20:42
Has thanked: 7 times
Been thanked: 2 times

{Solved} Sudoer broken Debian 11 - Resolved on my own but decided to post for future questioners

#1 Post by yodamin »

Hi I am not new to Debian or Linux but have been away for a long time. My Linux skill set can be describe as "hobbyist". I am trying hard to change that to expert administrator by doing this and ditching Windows by 2025 as I can't abide an OS that monitors every single thing I do and won't let even administrators do some basic administrative tasks; for example deleting the very last Ethernet driver from the system - even in safe mode!! What a BAD day THAT was.

Either way, I am trying to configure Debian now as I am familiar with it and other Debian based distros.
Not having sudo is a deal breaker.

What I have done so far:

1. groups output: myusername cdrom floppy audio dip video plugdev netdev bluetooth lpadmin scanner

2. as root using su - : usermod -aG sudo myusername
---verify:
root@grumpy:~# cat /etc/group | grep sudo
output: sudo:x:27:myusername

3. test:
myusername@grumpy:~$ sudo apt update
[sudo] password for myusername:
myusername is not in the sudoers file. This incident will be reported.

4. --verify again a different way:
myusername@grumpy:~$ h=`groups myusername| awk -F ":" '{print $2}'| grep -io 'sudo'`
if [[ $h == "sudo" ]]
then
echo "user myusername is part of group sudo"
else
echo "Need to add user to group sudo"
echo "Switch to root and add user"
fi
output user myusername is part of group sudo

5. test again:
myusername@grumpy:~$ sudo apt upgrade
[sudo] password for myusername:
myusername is not in the sudoers file. This incident will be reported.

6. visudo /etc/sudoers

manually added: myusername ALL=(ALL:ALL) ALL
saved as /etc/sudoers (not sudoers.tmp for example)

7: test: Forget it I resolved it by manually adding my username to /etc/sudoers <-----------------WHY did I have to do this at all? Why did running this as root not work?: usermod -aG sudo myusername

myusername@grumpy:~$ sudo apt update
[sudo] password for myusername:
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
myusername@grumpy:~$
Last edited by yodamin on 2022-10-12 23:28, edited 1 time in total.

User avatar
dilberts_left_nut
Administrator
Administrator
Posts: 5346
Joined: 2009-10-05 07:54
Location: enzed
Has thanked: 12 times
Been thanked: 66 times

Re: Sudoer broken Debian 11 - Resolved on my own but decided to post for future questioners

#2 Post by dilberts_left_nut »

You need to logout/in to pick up newly assigned groups
AdrianTM wrote:There's no hacker in my grandma...

yodamin
Posts: 23
Joined: 2022-10-03 20:42
Has thanked: 7 times
Been thanked: 2 times

Re: Sudoer broken Debian 11 - Resolved on my own but decided to post for future questioners

#3 Post by yodamin »

Fine Linux admin I'll be, I forgot to log off/on - embarrassed :-)

Post Reply