I am using Ubuntu 18.04. I accidentally removed the sudo group. Is there any way to recover from this? I still have access to the
root account. I tried to add the sudo group again with the root user, but this did not work, and I got an
This link helped me, then adding the
sudo group with
sudo addgroup sudo and adding my user to group with
sudo adduser -aG username sudo worked.
Reboot the computer. If Ubuntu is your primary and the only operating system in your computer, press the Shift button when it is booting up. This should make the GRUB screen show up on your monitor. On the GRUB screen, press the down keyboard key to the Recovery mode and press Enter.
On the next screen, select Check all file system (will exit read only mode).
When you see the message
Finished, press Enter, press Enter.
Next, select Drop to root shell prompt.
You will now be at the command line. Type:
usermod -a -G admin username
Replace the username with your own login user name.
That’s it. Now type
exitand select Resume normal boot.