Windows Subsystem for Linux allows you to run a Linux terminal within a Windows 10 environment. One of the best features of WSL is that it automatically logs you in as a default user as soon as you bring up the WSL terminal. And all this happens without the user’s default password.

In a Linux system, in case you forgot your password, you can reset it by booting into GRUB and resetting it from there. However, WSL doesn't follow a normal boot process, which makes the aforementioned process null and void. However, if you want to reset the password using WSL, there is an easier way to do so.

This guide will discuss the process of changing user passwords in Ubuntu WSL. The process for changing the password on other WSL distributions is more or less the same.

Change the User Password in Ubuntu WSL

  1. Change the default username for your WSL distro to root. Then, run the config command as follows:
            ubuntu config --default-user root
        
  2. Launch your Linux distribution, in case you are working with a default WSL distro.
  3. Reset your password by typing in the passwd command.
            passwd
        
  4. To reset the password of a specific user, pass the username with the command. For example:
            passwd winibhalla
        
  5. Leave your WSL session and set the default user of the WSL distro back to your user account.
            ubuntu config --default-user winibhalla
        

Note: You can use the following commands to change your default user to root in a WSL distro.

Related: Tips to Supercharge Your Windows Subsystem for Linux

Replace root with another user account name, so that the system sets it as the default user account for the distro in use. The commands to set the default user to root are the same in other Linux distributions as well.

To set root as the default user on Ubuntu:

        ubuntu config --default-user root
    

On OpenSuse Linux:

        sles-12 config --default-user root
    

Changing the default user on Kali Linux is easy as well:

        kali config --default-user root
    

To change the default user to root on Debian:

        debian config --default-user root
    

Resetting Your Password on WSL, the Easy Way

The process is rather simple, and even a novice can do it by using the above steps. The idea is to just follow the process step by step, and you just can’t go wrong.

On a traditional Linux installation, you can use the passwd command to change your account password easily. Unix is similar to Linux in terms of its architecture and commands, and the steps to change the user password are the same as in Linux.