Introduction
This article provides a step-by-step guide to resetting the password for the Ubuntu subsystem on Windows 10 when the password is unknown or forgotten.
Prerequisites
Before you begin, ensure the following prerequisites are met:
- Ubuntu subsystem (WSL) installed on your Microsoft Windows 10 laptop.
Resetting the Password
To reset the password for the Ubuntu subsystem on Windows 10, follow these steps:
-
Open the Windows PowerShell as an administrator. You can do this by searching for "PowerShell" in the Start menu, right-clicking on the PowerShell app, and selecting "Run as administrator."
-
Change the current directory to the WSL installation directory using the following command:
cd "%WINDIR%\System32\WSL\"> -
List all the installed WSL distributions using the following command:
wsl --list --verbose -
Locate the Ubuntu distribution in the output and take note of the "Distribution Name" and "State" values.
-
Use the following command to start the Ubuntu distribution with an interactive terminal:
wsl --distribution--set-default Replace
with the name of your Ubuntu distribution. -
Connect to the Ubuntu subsystem using your preferred SSH client or the Windows Terminal.
-
sudopasswd usernameReplace "username" with the actual username for the Ubuntu subsystem.
-
Set a new password for the user account:
NewPassword1Then, confirm the new password:
ConfirmNewPassword1
Conclusion
In this article, we have covered the process of resetting the password for the Ubuntu subsystem on Windows 10 when the password is unknown or forgotten. By following the steps outlined in this guide, you can easily reset the password and regain access to your Ubuntu subsystem.