Reset Ubuntu Password in WSL on Windows 10

WSL Jun 24, 2021

I recently wanted to install something within my Ubuntu shell and could not remember what the password was and thought I was stuck, however I found a way of resetting it quickly and easily.

  1. Open Bash on Ubuntu to take note of your Linux username (note that this may or may not match your Windows username)
  2. Close your bash session, you need to do this for the following commands to work.
  3. Open a Windows command prompt as Admin
  4. Enter ubuntu config --default-user root to set the default user as root.
  5. Now open your Ubuntu shell again.  This time you'll notice you are logged in as root.
  6. You now want to change the password of your account type, passwd [username] and follow the instructions to reset your password.  Close the Ubuntu shell.
  7. Now you want to change your Ubuntu shell back to have your profile as the default user.  Within a Windows command prompt run the following command ubuntu config --default-user [username]

Now when you open your Ubuntu shell your profile will default open to yours and the password will be reset.

Enjoy!

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.