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:
- Open the Windows Shell.
- Type in
wsl -l
to get the list of WSL Distributions you have on your system. - Login to the distribution using
wsl -d [Distribution Name]
. - Type in
whoami
to get your default user name. Note this down. - Logout of the distribution, by typing
exit
. - Log in as root:
wsl -d [Distribution Name] -u root
. - Change the password for the user by running this
passwd [User Name]
and follow the instructions. - If all goes well you should get a “passwd: password updated successfully” message.
- Logout again using
exit
. - Now you can use the new password for your WSL Distribution default user.
Hope this was helpful to you. Thanks for reading.
Leave a Reply