1

For some reason my main and only user in Debian (Windows Subsystem For Linux v2) is not a sudoer any more.

sudo apt-get install <whatever>
myuser is not in the sudoers file

I know I can add myself to sudoers via usermod -aG sudo myuser but how do that since I'm the only user? Also, If I try to run su to workaround this, my wsl password is not working.

2 Answers 2

2

Turns out you can switch to root from a normal command prompt (cmd.exe)

debian config --default-user root

and then re-add the user to sudoers in a new wsl instance

usermod -aG sudo myuser

finally, switch to my user

su - myuser

2

In command prompt, start distro as root:

wsl -d MY_DISTRO --user root

Then run:

usermod -aG sudo MY_USER

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .