Ubuntu: Reset the Password in Linux Bash in Windows


I have installed the Linux Bash on Windows 10(which is available in recent update from Microsoft), but it's been long I happened to forgot my password now.

I have checked many websites and all it says is to go through the booting option where it will not work in this case as this is Windows system.

How can I get to reset my password?


  1. Run bashand make a note of your Linux username (this need not match your Windows username)
  2. In Windows admin command prompt (Super+X, A) change the default user to root:

    lxrun /setdefaultuser root  
  3. Now Bash on Ubuntu on Windows logs you in as root without asking password

  4. Use passwd command in Bash to change the user password:

    passwd your_username  
  5. Change the default user back to your normal user in Windows command prompt

    lxrun /setdefaultuser your_username  


To add to Tmu's answer, here's a Powershell script (gist) that automates the process (including automatically detecting the current default username)

# Resets the password for the default LXSS / WSL bash user  $lxssUsername = (Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss).DefaultUsername  lxrun /setdefaultuser root  bash -c "passwd $lxssUsername"  lxrun /setdefaultuser $lxssUsername  


The above did not work. Even after changing default user, the bash always opened with my user. So instead this worked:

  1. edit file (in notepad or notepad++):

  2. find your normal user, for example:


    and simply remove the hash part (below part)


    you will see a different hash - I hope :), so should look like:

  3. Save the file

  4. start bash again
  5. sudo bash
  6. password this will ask for your new password without requiring previous one.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »