Reset WSL user Password

Reset WSL user Password

Windows Subsystem for Linux, commonly known as WSL, is a feature that allows users to run supported Linux distributions straight from Windows. Unlike dual boot, which requires users to reboot to the target Linux system, WSL runs inside windows like a regular application.

In a standard Linux environment (either on a virtual machine or bare metal), you can make tweaks from the GRUB and reset it if you forget your password.

On WSL, things tend to be slightly different because it does not contain a bootloader for you to edit. It also does not feature init system, which you can hijack to launch a root shell.

However, this does not mean you need to uninstall and re-install your WSL instance to reset a forgotten password. This guide walks you through simple steps to reset your password in WSL instances.

Using the root account.

A simple method to recover or reset a forgotten password for a WSL user is to use the root account.

In most WSL distributions, the root account is enabled and does not have a password set for it.

Since WSL automatically logs in to the set default account without a password prompt, we can change the configuration file and set the default account as root.

To change the configuration, we need to use the WSL instance executable. By default, the executable file is located in

NOTE:  Replace the username with your account username and the distribution name with your WSL distro.

For example, the openSUSE 15.3 Leap executable would be


To change the configuration for the distro, launch the command prompt and enter the command matching your distribution name.

For example, for openSUSE, set the default user to root with the command:

opensuse-leap-15.3 config --default-user root

The above command will change the default user to root for openSUSE WSL instance.

For other distributions, the commands are as shown:


ubuntu config --default-user root

Ubuntu 18.04

ubuntu18004 config --default-user root

Ubuntu 20.04

ubuntu2004 config --default-user root

Kali Linux

kali config --default-user root


debian config --default-user root

Arch Linux

arch config --default-user root

The final step is to log in to your distribution and change the password for your target username.

You can launch your distribution using the start menu, the command prompt, or selecting it from the Windows terminal.

Once you launch it, you should be logged in as root.

Finally, use the passwd command to change the password.

For example, to change the password for the geekbits username, set the command:

passwd geekbits

Restore default User

Once you reset the password for the specific user, it is recommended to change the default user instead of the root account.

Use the config command and replace the username with your desired account.

For example:

opensuse-leap-15.3 config --default-user cap

Remember to replace it with your distribution name.


This tutorial describes straightforward steps to reset the password for a WSL user. The steps discussed in this tutorial are simple and do not pose much threat to your WSL instances. However, always secure your systems in case of compromise.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.