I forgot the username and password that I created in Ubuntu in WSL environment

Asked 2 years ago, Updated 2 years ago, 75 views

There is something I would like you to understand in advance.
I've just started learning PC and programming, and I'm probably like a baby when it comes to IT.
I would like to solve the problem with my poor writing and my poor knowledge.
I would appreciate it if you could help me if this catches my eye and you can understand what I'm saying and how to solve it.
Thank you for your cooperation.

Windows 10 WSL
Ubuntu 20.04 LTS

I was thinking of downloading Ubuntu in Windows 10 and using it to build a virtual environment such as Vscode, but when I tried to use Ubuntu for the first time in a while, I forgot my password and couldn't use it.

  • How to reset the password in the root shell by pressing ESC and shift keys on the reboot screen
    → Press ESC and shift keys but the screen does not change
    I tried the above solutions and looked for other possible solutions, but I couldn't.

  • Open Ubuntu from the command prompt to become the root user and force a password change
    I could probably change the password without using the password, but it didn't work because I had to have a username to do so and forgot the username.

How do I reset the password in the root shell by pressing ESC and shift keys on the reboot screen?
→ Press ESC and shift keys but the screen does not change
I tried the above solutions and looked for other possible solutions, but I couldn't.

Open Ubuntu from a command prompt to become the root user and force a password change
I could probably change the password without using the password, but it didn't work because I had to have a username to do so and forgot the username.

Please let me know if there is any other solution besides the above.
I don't know the solution, but I'd appreciate it if you could point out that your knowledge is off and wrong.Thank you in advance.

ubuntu wsl

2022-09-30 20:12

1 Answers

Changing Login Users (Temporary)

Open a command prompt and change the default user to root.

>ubuntu config -- default-user root

After the above configuration changes, please open the Ubuntu window to see if you can log in as the root user.

Verifying Username

In Ubuntu (Linux), account information is recorded in /etc/passwd, so check this to see which username you have in mind.

>cat/etc/passwd

Once the username has been verified, set the new password with the passwd command.
Specify the username you want to change following the passwd command.

#passwd USER

Once the password is set, restore the default user at the command prompt.

>ubuntu config -- default-user USER

reference:
What to do if you forget your Linux password on the WSL


2022-09-30 20:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.