DEV Community

Cover image for How to Reset Ubuntu Passwd in WSL2
FlatlinerAtheist | CLI-NERDS
FlatlinerAtheist | CLI-NERDS

Posted on Originally published at clinerds.com

How to Reset Ubuntu Passwd in WSL2

Microsoft has introducedWindows Subsystem for Linux, or WSL, which lets users run their favorite Linux distributions directly from Windows 10 without dual-booting or using a virtual machine. Thanks to the efforts of Offensive Security and the WSL team at Microsoft, Kali Linux is now the most recent addition to the Microsoft Store.

When you install UNIX/Linux operating system with the help of WSL on Windows, you're asked to make a username and password. This user is mechanically logged on once you begin UNIX/Linux operating system on WSL.

Now, the matter is that if you haven't used it for a few time, you will forget the account password of WSL. And this can become a haul if you have got to use a command with sudo as a result of here you'll have to be compelled to enter the password.

Don't worry. you'll be able to simply reset it.

Reset forgotten word for Ubuntu or the otherUNIX distribution on WSL

To reset the UNIX Password in WSL, you have got to:

Switch the default user to root

Reset the word for the conventional user

Switch back the default user to the conventional user

Let ME show you the steps intimately

Step 1: Switch to root as default user

It will be wise note your account's normal/regular username. As you'll see, my regular account's username is clinerd

The root user in WSL is unbarred and doesn't have a positive identification set. this impliesthat you simplywill switch to the basis user so use the facility of root to reset the positive identification.

Since you don't keep in mind the account positive identification, change to the basis user is completed by dynamical the configuration of your Linux WSL application and build it use root user by default.

This is done through Windows electronic communication and you'll ought tounderstandthat command you wish to endure your UNIX distribution.

This infois typically provided within the description of the distribution app within the Windows Store. this is often from wherever you had downloaded your distribution within the1st place.

*Start Command Promp*t

In here, use your distribution's command during this fashion. If you were using the Ubuntu app from Windows store, the command would be:

ubuntu config --default-user root
Enter fullscreen mode Exit fullscreen mode
Distribution App Windows Command
Ubuntu ubuntu config -default-user root
Ubuntu 20.04 ubuntu2004 config -default-user root
Ubuntu 18.04 ubuntu1804 config -default-user root
Debian debian config -default-user root
Kali Linux kali config -default-user root

Step 2: Reset the password for the account

Now, if you begin the UNIX system distribution app, you must be logged in as root. you'll be able to reset the password for the traditional user account.

Do you bear in mind the username in WSL? If not, you'll be able tocontinually check the contents of the /home directory. after you have the username, use this command:

passwd username
Enter fullscreen mode Exit fullscreen mode

It will raise you to enter a new password. after you type here, nothing are displayed on the screen. That's traditional. simply sort the new password and hit enter. You'll got to retype the new password to substantiate and all over again, nothing are displayed on the screen whereas you type the password.

Congratulations. The password for the user account has been reset. however you're done simply nevertheless. The default user remains root. you ought to modification it back to your regular account user, otherwise it'll continue work in as root user.

Step 3: Set regular user as default again

ubuntu config --default-user username
Enter fullscreen mode Exit fullscreen mode

Share Article:

reset linux passwd, reset wsl2 password

Top comments (0)