Password Reset Made Easy: A Simple Guide for WSL Users

Ever found yourself staring at your WSL terminal, desperately trying to remember your password?

 

The frustration can be real! But don't worry, this guide has your back. We'll walk you through the simple steps to reset your WSL password, so you can get back to your projects in no time. No more password panic! Let's dive in and regain access to your WSL world.

Step 1: Find Your WSL Distribution

Before you start, you need to know which WSL distribution you’re using. Here’s how:

1. Open PowerShell or Command Prompt as Administrator:

   - Right-click the Start button and choose PowerShell (Admin) or Command Prompt (Admin).

2. List Installed WSL Distributions:

  1. Type the following command to see all installed distributions:

     wsl --list

  1. You’ll see a list of all installed distributions like Ubuntu, Debian, etc. Note the name of the distribution you want to modify

 

Step 2: Open WSL Terminal as Root

1. Launch your WSL distribution as root:

  1. In PowerShell or Command Prompt, type:

     wsl -d distribution_name -u root

  1. Replace `distribution_name` with the name of your distribution, such as `Ubuntu`.

 

step 3:  Ensure Your Command Worked

You should see something similar to this:

vous pouvez le comparer avec celui ci d’ou l’on vient:

Step 4: Who Are You?

To change your password, you need to enter the command:

whoami

Cette commande sera utile pour faire des changement

 

Step 3: Reset the Password

1. Change the password for the root user:

  1. In the root terminal, type:

     passwd root

  1. You’ll be prompted to enter a new password for the root user. Enter it carefully!

 

2. Change the password for another user (if needed):

  1. If you need to reset the password for another user, type:

     passwd username

  1. Replace `username` with the actual username for which you want to change the password.

 

Step 4: Exit Root Mode

1. After resetting the password, type:

   exit

  1. This command will exit the root shell and return you to your normal user session if you opened the WSL terminal with that option.

2. Open a new WSL terminal:

  1. If you want to restart a session with your normal user, simply close the current terminal and open a new WSL terminal from the Start menu in Windows.

You’ve successfully reset your password and returned to a normal session! That’s all there is to it. You can now log in with your new password and continue using your WSL without any issues.

If you have any more questions or if something isn’t working as expected, feel free to ask. Happy using your Linux subsystem on Windows!