Oops! Password Reset Ubuntu: Windows Subsystem for Linux (WSL)

I typically like to write a blog whenever I encounter a problem that I have to research a solution. This particular issue was forgetting the password to my administrative account in my WSL Ubuntu installation. If you ever get into this same predicament, there are a couple really simple steps to get you back up and running.

Firstly, start by opening your WSL Ubuntu installation and figuring out what your user is. If you kept it the default ubuntu feel free to skip this part.

Next, you’ll want to log out (important) using exit.

Once you’re out, you can change the default user with which your computer is logging into your WSL environment.

ubuntu config --default-user root

Now that you’ve elevated your permissions, you can go ahead and run passwd ubuntu to change your password. exit a few times to leave the WSL once complete.

To get back to logging in as ubuntu or your default user, run ubuntu config --default-user ubuntu and you’ll be good to go!

All commands in sequence (from Windows command prompt) skipping input and output:

ubuntu.exe
whoami [assuming it's ubuntu]
exit
ubuntu config --default-user root
ubuntu.exe
passwd ubuntu [enter password in prompts when asked]
exit
ubuntu config --default-user ubuntu
ubuntu.exe

Hope this helps someone out there!

Leave a Reply

Your email address will not be published. Required fields are marked *