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.


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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.