Quantcast
Viewing latest article 6
Browse Latest Browse All 8

Answer by Vladimir Jirasek for Reset the password in Ubuntu / Linux Bash in Windows

ImportantThis 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++):

     %localappdata%\lxss\rootfs\etc\shadow
  2. Find your normal user, for example:

     user1:$jsdjksadgfhsdf.saflsdf.sadf.safd:17299:0:99999:7:::

and simply remove the hash part (below part)

    $jsdjksadgfhsdf.saflsdf.sadf.safd

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

    user1::17299:0:99999:7:::
  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.


Viewing latest article 6
Browse Latest Browse All 8

Trending Articles