if you forgot password for your own account then try to login with root user and reset it for your account (instruction mentioned below).
# passwd <your_user>
if you forgot password for the root account; try to open a root shell with sudo -i
and type your own user's password and change the password for the root account.
# passwd root
Another options is resetting from Windows Powershell for newer Windows10 version:
Open PowerShell and enter the root of your default WSL distribution using the command:
wsl -u root
If you need to update the forgotten password on a distribution that is not your default, use the command: wsl -d Debian -u root
, replacing Debian
with the name of your targeted distribution.
Once your WSL distribution has been opened at the root level inside PowerShell, you can use this command to update your password: passwd
You will be prompted to enter a new UNIX password and then confirm that password. Once you're told that the password has updated successfully, close WSL inside of PowerShell using the command: exit
this is for previous versions:
For Creators Update version of Windows and earlier
If you're running Windows 10 Creators update or earlier, you can change the default Bash user by running the following commands:
Change the default user to root:
C:\> lxrun /setdefaultuser root
Run bash.exe
to now login as root
:
C:\> bash.exe
Reset your password using the distribution's password command, and close the Linux Console:
# passwd username
# exit
From Windows CMD, reset your default user back to your normal Linux user account:
C:\> lxrun.exe /setdefaultuser username
For Fall Creators Update and later
To see what commands are available for a particular distribution, run [distro.exe] /?
(replace distro
with the distribution name you have installed like ubuntu.exe /?
).
Step by step instructions using Ubuntu:
- Open CMD
Set the default Linux user to root
:
C:\> ubuntu config --default-user root
- Launch your Linux distribution (
ubuntu
). You will automatically login as root
.
Reset your password using the passwd
command:
# passwd username
From Windows CMD, reset your default user back to your normal Linux user account.
C:\> ubuntu config --default-user username
Note: Replace ubuntu
with ubuntu1604
or ubuntu1804
if you're using Ubuntu 16.04 or Ubuntu 18.04 app.
ubuntu isn't a recognized command
, please verify the Ubuntu app you're using. If it's Ubuntu, command will beubuntu
but for 18.04, it'll beubuntu1804
and for 16.04, it'll beubuntu1604
. Moreover, control panel only shows program which were installed using executables instead of Windows Store, i.e. it shows programs with executables not UWP – Kulfy Apr 10 '20 at 11:36Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
and then reboot the system. Trywsl -l -v
. – Kulfy Apr 11 '20 at 10:06