If you forget your Windows Subsystem for Linux (WSL) password, try this.

I have been using Windows Subsystem for Linux (WSL) for a while now and sometimes I create a distribution and forget the password. If you find your self in the same situation, just follow these steps:

  1. Open the Windows Shell.
  2. Type in wsl -l to get the list of WSL Distributions you have on your system.
  3. Login to the distribution using wsl -d [Distribution Name].
  4. Type in whoami to get your default user name. Note this down.
  5. Logout of the distribution, by typing exit.
  6. Log in as root: wsl -d [Distribution Name] -u root.
  7. Change the password for the user by running this passwd [User Name] and follow the instructions.
  8. If all goes well you should get a “passwd: password updated successfully” message.
  9. Logout again using exit .
  10. Now you can use the new password for your WSL Distribution default user.

Hope this was helpful to you. Thanks for reading.


Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.