WSL - Reset user password

De PedroWiki

Introduction

If you loose or forget your basic account in WSL, this article describes how to reset it quickly.

Reset the password

Turn the defaut user to root

  • Open a CMD prompt.
  • Call your WSL distribution executable with appropriate parameters:
debian.exe config --default-user root

Launch a new WSL instance and reset the password

  • your new instance should start with user root.
  • type:
passwd <your_username>
  • set the password to a value you will store somewhere.

Set the default user to it's original value

debian.exe config --default-user <your_username>