I'm using Debian on a headless server that I'm connecting to via ssh.
When I installed Debian, I did not create a root account, so the first user created was in the sudo group. Then I added that user to another group, but in my ignorance I used:
sudo usermod -G NewGroup UserName
sudo usermod -aG NewGroup UserName
Without the 'a' (append), this removed the user from every group (including sudo) other than the default UserName group.
I've learned my lesson now, but is there any way to regain superuser access to this installation?
This is a test environment with nothing to backup or recover, so I can simply reformat if all is lost, but I thought I'd ask anyway.