Reset the Password in Linux Ubuntu Bash in Windows 10

2021 Method for Resetting Windows Subsystem for Linux Password

Frank H. sent me an note letting me know of a new method to reset the Linux Subsystem for Windows password.

The steps you have to reset the Linux root password on windows no longer work.

You can reset the Linux root password on windows by following these steps

  1. Start an admin command shell
    wsl --user root
    Typing 'wsl --user root' will start the Windows Linux sub-shell logged in as root.
  2. Use passwd command in Bash to change the user password:

    passwd your_username

lxrun has been deprecated - this method no longer works!

For those who set up Ubuntu Linux Bash on Windows 10 but forgot what password they used. I set this up quite a while ago on a computer that I seldom use, and I needed to reset my password. Here are the steps I found from Ask Ubuntu.

  1. Run bashand make a note of your Linux username (this need not match your Windows username)
  2. In Windows admin command prompt (Windows Key+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

windows 10 change password linux ubuntu

Where are my Windows files on Windows Linux Bash?

You'll find the Windows C: structure at /mnt/c/ in the Bash environment.

Therefore, USERNAME's Documents directory is located here: 

/mnt/c/Users/USERNAME/Documents/

Where are my Ubuntu Bash files in Windows 10?

Remember, don’t modify any of these files or add files to these folders from File Explorer!

In Ubuntu Linux Bash for Windows, the Ubuntu file system root directory

%userprofile%AppDataLocalPackages

or

C:/Users/USERNAME/AppData/Local/Packages

Replace the Username with your Username on Windows.

 

There are many directories in this folder, but look for one matching your flavor of Linux:

  • Ubuntu: CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
  • openSUSE Leap 42: 46932SUSE.openSUSELeap42.2_022rs5jcyhyac
  • SUSE Linux Enterprise Server 12: 46932SUSE.SUSELinuxEnterpriseServer12SP2_022rs5jcyhyac

The names of these folders may change slightly in the future. Just look for a folder named after the Linux distribution.
(Thanks to How to Geek for this new Windows Subsystem for Linux folder location.)

Previous location on Windows for Linux files

They are no longer found here -- 2021

The Ubuntu system files are stored at:

C:/Users/USERNAME/AppData/Local/Lxss/rootfs

 

Your Ubuntu user account’s home folder is stored at:

C:/Users/USERNAME/AppData/Local/Lxss/home/USERNAME

 

The root account’s home folder is stored at:

C:/Users/USERNAME/AppData/Local/Lxss/root

 

Visit sunny St. George, Utah, USA