Reset Password for WSL Linux Distro in Windows 10

If you forgot the password for your user account in a WSL Linux distro, and are unable to log in to its console, then this article will definitely be useful for you. We will see how to reset the account password in WSL Linux without using third party tools.

The ability to run Linux natively in Windows 10 is provided by the WSL feature. WSL stands for Windows Subsystem for Linux, which initially, was limited to Ubuntu only. Modern versions of WSL allow installing and running multiple Linux distros from Microsoft Store.

Linux Distros Microsoft Store Windows 10

After enabling WSL, you can install various Linux versions from the Store. You can use the following links:

  1. Ubuntu
  2. openSUSE Leap
  3. SUSE Linux Enterprise Server
  4. Kali Linux for WSL
  5. Debian GNU/Linux

and more.

When you start a WSL distro for the first time, it opens a console window with a progress bar. After a moment of waiting, you will be prompted to type a new user account name, and its password. This account will be your default WSL user account that will be used to sign-in automatically every time you run the current distro. Also, it will be included in the 'sudo' group in order to allow it to run commands elevated (as root).

Each Linux distribution running on the Windows Subsystem for Linux has its own Linux user accounts and passwords. You will have to configure a Linux user account any time you add a distribution, reinstall, or reset. Linux user accounts are not only independent per distribution, they are also independent from your Windows user account.

To Reset the Password for a WSL Linux Distro in Windows 10,

  1. Change the default user name for your WSL distro to root. Use the following command: ubuntu config --default-user root. For other distros, see Note below.Windows 10 WSL Set Default Password To Root
  2. Launch your Linux distribution, e.g. type ubuntu, or wsl if you are working with your default WSL distro.Windows 10 WSL Run Distro As Root
  3. Reset your password using the passwd command: passwd <username>. Substitute the <username> portion with the actual user name you want to reset the password for, e.g. #passwd winaero.Windows 10 WSL Reset User Password
  4. Leave your WSL session and set the default user of the WSL distro back to your user account, e.g. ubuntu config --default-user winaero.Windows 10 WSL Restore Default User Account

Note: Use the following commands to change your default user to root in a WSL distro. By replacing 'root' with another user account name, you'll set it as your default user account for the distro.

  • Ubuntu: ubuntu config --default-user root
  • openSUSE Leap 42: openSUSE-42 config --default-user root
  • SUSE Linux: SLES-12 config --default-user root
  • Debian: debian config --default-user root
  • Kali Linux: kali config --default-user root

That's it.

Articles of interest:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.