From what I can gather from scanning through DT's video that you watched, you got hung up on the initial "setup" of the Ubuntu distribution on WSL. It sounds like it installed, then it asked for your preferred username and password, but you weren't able to get it to input for some reason.
To answer your question of how to resolve it from here, there's good news. WSL makes it fairly easy to recover from almost any mistake you might make.
Open a PowerShell or CMD prompt, and launch WSL via wsl -u root
. This will start as the "administrative user" (known as "root" in Linux). It's generally considered a bad idea to run as root when you don't need to, so plan on using your default user most of the time. But we can use root to reset the password of your primary user or create it if it doesn't exist.
Since I'm not sure if it actually created a username/password pair for you or not, let's check. In the WSL shell you launched as root, type the following:
cat /etc/passwd | grep bash
This is going to either give you one or two lines. The first will be the root user. The second, if it exists, is the primary user that you created during the initial configuration.
Option 1: If that user did get created, I'm going to assume that it is "joel". If it's something else, just substitute your user id in the following command. Reset the password for that user with passwd joel
. Remember, the command isn't going to show anything being typed, not even something like ****
. Just make sure you type the same thing at both prompts and hit enter. If you typed the same thing both times, you'll see:
New password:
Retype new password:
passwd: password updated successfully
If it wasn't successful, you'll see:
New password:
Retype new password:
Sorry, passwords do not match.
passwd: Authentication token manipulation error
passwd: password unchanged
Exit the root session (exit
or Ctrl+D), launch WSL again without the -u root
, and you should be logged in as that user. You will not be asked for the password in most cases. It will only be used for things like ssh
, sudo
, and others.
Option 2: If there's only one line returned from the cat
command above, then we still need to create the user. That's going to be a little more complicated.
Create the user with adduser joel
. It will request the password and some other information that you can change or just leave alone.
usermod -a -G sudo abc
. This adds the user to the sudo
group so that you can use that command to perform administrative tasks under a non-root user. You'll learn about it as you learn Linux, but it will be very important that your default user is a member of that group. It's possible in WSL to do without it, but as I said earlier, it's "best practice" to not run as the root user if you don't need to. sudo
makes it so you don't need to.
Finally, you are going to need to tell WSL to start up using this user. Normally WSL would configure that in the Registry during that install/configuration step, but if we're at this point, it probably didn't do it. Create a file using nano /etc/wsl.conf
with the following contents:
[user]
default=joel
Save it, exit, and exit your WSL session (exit
or Ctrl+D). Then restart it with just the wsl
command (typed from PowerShell, the Start Menu, or CMD).
If all went well, you should be running as your user. The prompt should, by default, show your username@hostname.
If not, then an uninstall/reinstall of Ubuntu using the Microsoft Store is probably your next best bet.