I have installed Linux Bash on Windows 10 (available from Microsoft), but I've forgotten my password.

I've searched for a solution but I only find suggestions that involve doing something before the system boots, like accessing recovery mode, but that will not work in this case as this Ubuntu is just an application within a Windows system and doesn't have its own boot process.

How can I reset my password?

  • 5
    Which password did you lose exactly? Your Windows account password? Commented Aug 6, 2016 at 12:08
  • an example "booting option" would be to boot to single user mode by setting kernel cmdline to "single" via grub. For those curious.
    – Kevin
    Commented Jun 28, 2017 at 16:53

7 Answers 7

  • Run bash and make a note of your Linux username (this need not match your Windows username), see How can I find out my user name?
  • Close Bash on Ubuntu if it is running (or the next command will fail).
  • In Windows admin command prompt (Super+X, A) change the default user to root:

    ubuntu config --default-user root

If you are using Ubuntu 18.04 in WSL, the command has changed to ubuntu1804 , so

ubuntu1804 config --default-user root
  • Now Bash on Ubuntu on Windows logs you in as root without asking password
  • Use passwd command in Bash to change the user password (the user whose password you want to reset):

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

    ubuntu config --default-user  your_username

If you are using Ubuntu 18.04 in WSL, the command has changed to ubuntu1804 , so

ubuntu1804 config --default-user your_username

Watch Full Video to Recover your password Windows Subsystem Linux https://youtu.be/dTR232yvDCE

Note 1: The subsystem used in the video is not Ubuntu, but Kali Linux. Hence the difference in the command.

Note 2: If you are still using the original Ubuntu subsystem that came with the Anniversary Update, use the command lxrun. Upgrade to the subsystem version distributed via Microsoft Store is recommended.)

  • 7
    lxrun is for beta version of WSL. If you install ubuntu from the app store, the command is ubuntu config --default-user root. Commented Nov 19, 2017 at 9:13
  • 2
    Yeah, this is an alternative way but I got the error: Failed to set default user to: root.
    – Kirby
    Commented Dec 17, 2017 at 7:47
  • 3
    @Kirby: you must log out from the WSL shell before running the command in the Windows command prompt.
    – dr_
    Commented Mar 22, 2018 at 9:16
  • 1
    I kept getting Error: 0x80070057 The parameter is incorrect, so I ended up following @dr01 's cue and ran ubuntu in PowerShell, then logout, then configured the default user again. Success 👍
    – nikodaemus
    Commented Jun 7, 2018 at 13:42
  • 4
    If you installed ubuntu 18.04 on WSL, the command is ubuntu1804 instead of ubuntu. Hope this saves some head-scratching.
    – Indominus
    Commented Jun 8, 2018 at 3:43

Microsoft has a good help page on this: WSL User documentation.

In Windows PowerShell (Super+X, i) you can log in to the Ubuntu root account with

wsl --user root

Then change the password as you usually would, i.e. for the current user (which is root) with


or for another user with

passwd username

which interactively asks you for a new password (twice). Windows admin privileges are not required.

If you have more than one distribution installed in WSL, then you can list the names of the installed distributions with

wsl -l

and then use the name of the distribution to specify into which distribution you want to log in to, for example to log into Ubuntu 20.04:

wsl -d Ubuntu-20.04 --user root
  • 3
    Awesome! This works as of 10/2019. And, very important, this prompt command works even without administrator privileges on the Windows machine (that's a time- and money-saver if you're on a company PC). Commented Oct 14, 2019 at 10:08
  • 1
    That change root password - yes, after it just launch Ubuntu under Windows and under console type: $ su root # passwd YOUR_ACCOUNT_NAME
    – dawciobiel
    Commented Nov 28, 2019 at 23:01
  • Didn't work on the VM because I don't know the old password. Commented Dec 8, 2019 at 0:58
  • 1
    @GringoSuave When you are root it doesn't ask for a password. Did you skip the first step or add additional ones in between?
    – Nobody
    Commented Dec 8, 2019 at 17:30
  • 4
    Yes, figured it out. Had to use passwd user. Thanks. Commented Dec 8, 2019 at 17:31

Important This answer is (a) for the older WSL1 only, (b) is outdated as it references paths that are no longer used by WSL1, even, and (c) most importantly, can cause filesystem corruption, per Microsoft. Please refer to other answers here for proper methods of changing the password.

The above did not work. Even after changing default user, Bash always opened with my user.

So instead I did this, which worked:

  1. Edit this 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 it should look like:

  1. Save the file

  2. Start Bash again with root privileges and set your password

      sudo bash
      passwd <your-user-name> 

You can now set a new password without having to enter the previous one.

  • 16
    this works but the official directory is now similar to %localappdata%\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\etc\shadow Commented Dec 21, 2017 at 8:13
  • 14
    This is the best answer by far. To find the path to your shadow file you can use this PowerShell abomination: Get-ChildItem -Path C:\ -Filter shadow -Recurse -ErrorAction SilentlyContinue -Force which is an insanely verbose version of find /mnt/c/ -name shadow in both execution and results. No need for elevated privileges to edit the file, but make sure your bash window is closed before you do it.
    – Russ
    Commented Jan 4, 2018 at 5:29
  • 2
    This is the winner! Worked great when the first answer did not.
    – Kim
    Commented Mar 15, 2018 at 15:29
  • 1
    The accepted answer got me 'Error: 0x80070057 The parameter is incorrect.'. (and no, the console was not in legacy mode). This worked seamlessly; Commented May 24, 2018 at 10:00
  • 1
    This answer worked exactly as outlined above. The first answer did not work for me. Commented Feb 20, 2019 at 15:01

Edit This no longer works if you have a store-installed distribution of WSL.

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
  • getting E r r o r : 0 x 8 0 0 7 0 0 0 2 in powershell Commented Mar 5, 2019 at 6:45

I needed to reset my password also in my Windows 10, I has WLS 1

1- Check your linux/ubuntu name, listing the folder:


In my case I found Ubuntu1604.exe, so I will use ubuntu1604 like name for the next step.  list files in: %userprofile%\AppData\Local\Microsoft\WindowsApps

2- Open CMD with administrator privilegies and run (you will get nothing in return):

ubuntu1604 config --default-user root

3- Start your WSL, check that you get root privilegues or run whoami (you need to be root) and change your password with:

passwd [your-linux-username]

4- Close your WSL and get back to the CMD Window and set back your default linux username:

ubuntu1604 config --default-user [your-linux-username]

5- Start your WSL/Ubuntu/AnotherLinux again, check and enjoy.


The other answers here, while mostly valid, are vastly overcomplicated. To change your user password in any WSL distribution, simply:

From inside Ubuntu (or another distribution):

wsl.exe \~ -u root -d $WSL_DISTRO_NAME -e passwd $USER

*Requires WSL Interop to be enabled.

Or from PowerShell or CMD (as a regular, non-admin user):

wsl ~ -u root -e passwd <username>
# Add the -d <distro_name> if not using the default distro

*Does not require WSL Interop.


For those of you who lost the root password, what worked for me, was updating to Ubuntu 18.04 LTS via the Windows Store. Note, the windows store has two distinct options:

  1. Ubuntu
  2. Ubuntu 18.04 LTS (Pick this one)

To check your current version, run the following as any user:

At command prompt, enter:

cat /etc/*release

You should see a line in the output that says:


If you see that, then definitely update to 18.04, and it will prompt you to create new UNIX credentials.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .