The right way to Reset the Person Password in Linux WSL

Do you want to change a user's password on the Windows Subsystem for Linux? These instructions will help you.

Windows Subsystem for Linux lets you run a Linux terminal in a Windows 10 environment. One of the best features of WSL is that you are automatically logged in as a standard user as soon as you enter the WSL terminal. And all without the user's default password.

If you've forgotten your password on a Linux system, you can reset it by booting into GRUB and resetting it from there. However, WSL does not follow a normal boot process, making the above process null and void. However, if you want to reset the password using WSL, there is an easier way.

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

Change the user password in Ubuntu WSL

  1. Change the default username for your WSL distribution to root. Then run the configuration Command as follows:
    ubuntu config –default-user root

  2. Start your Linux distribution if you are using a standard WSL distribution.

  3. Reset your password by doing the passwd Command.

  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 standard user of the WSL distribution back to your user account.
    ubuntu config –default-user winibhalla

Note: The following commands can be used to change your default user to root in a WSL distribution.

Related: Tips for Charging Your Windows Subsystem for Linux

Replace root with a different user account name so that the system will set it as the default user account for the distribution in use. The commands for setting the default user to root are the same in other Linux distributions.

To make root the default user on Ubuntu:

ubuntu config –default-user root

Under OpenSuse Linux:

sles-12 config –default-user root

Changing the default user on Kali Linux is also easy:

kali config –default-user root

How to change the default user on Debian to root:

debian config –default-user root

Resetting your password on WSL, the easy way

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

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

How to change your Unix password

Do you need to change your password on Linux or other Unix-like operating systems? Here's what you need to know.

Continue reading

About the author

Wini Bhalla
(4 articles published)

By Wini Bhalla

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email you just sent.

Leave a Reply

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