Jan 3rd, 2020 - written by Kimserey with .
During the installation of WSL, we are asked to create a user and a password for that user. Each sudo
commands will require the password input. In this post we will see how we can reset that password.
When we install WSL, we get access to ubuntu
command.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ ubuntu -h
Launches or configures a Linux distribution.
Usage:
<no args>
Launches the user's default shell in the user's home directory.
install [--root]
Install the distribuiton and do not launch the shell when complete.
--root
Do not create a user account and leave the default user set to root.
run <command line>
Run the provided command line in the current working directory. If no
command line is provided, the default shell is launched.
config [setting [value]]
Configure settings for this distribution.
Settings:
--default-user <username>
Sets the default user to <username>. This must be an existing user.
help
Print usage information.
With config --default-user root
we can set the default user to the root
user.
1
$ ubuntu config --default-user root
Then when we access bash
,
1
$ bash
We are now logged in with the root user and are able to change the password of our user:
1
2
$ passwd kimserey
$ exit
We can then set back our default user:
1
$ ubuntu config --default-user kimserey
And we should now be able to execute sudo
commands with our new password.