Score:0

Ubuntu 20.04 LTS for Windows 10 not allowing me to input password or change it?

it flag

Basically the title, but after following an online tutorial about learning Linux, I decided to try it out and install it on my computer.

Thought everything would work perfectly well until I stumbled on to the password problem, which for some reason did not allow me to input anything into the password section. I accidentally right clicked on time during my desperation to create a new password and noticed that pasting something into that section, even though not appearing, would get recorded by the system and save it as a password. I tried doing this two times by copying and pasting a password of my choice and by typing into there, both which did not work.

So is there anything I can do to resolve this issue?

Nmath avatar
ng flag
You are describing the typical behavior of these fields. There is no problem except to learn that the right mouse button pastes in a Windows command line prompt (even when using Ubuntu inside the Windows shell). Also, when you are prompted for a password in bash in Ubuntu, there is no on-screen feedback. You just need to type the correct password, then Enter. If you need to reset your password because you do not know it, you should search/research how to do that task.
Joel  avatar
it flag
I figured that would be it and tested it out, but apparently it does not work(same exact pass and everything). Realised it would be better to not use an account at all anyway since it was giving me an issue for no reason. And yeah I understand the right click paste thing, it's how I arrived at that conclusion, but eh oh well.
Nmath avatar
ng flag
What exactly isn't working?
user535733 avatar
cn flag
You have tagged WSL. Is that accurate? WSL does not use password, since it runs in Windows userspace.
NotTheDr01ds avatar
vn flag
@user535733 Apologies if this is pedantic, but WSL Linux distributions *do* maintain and utilize a uid and password for the primary user. You can see it in action when logging in via SSH, or when simply doing a `sudo`. It would be more accurate to say that WSL doesn't use PAM/login.
user535733 avatar
cn flag
@NotTheDr01ds, well said. An accurate and welcome clarification.
Score:0
vn flag

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.

Joel  avatar
it flag
Thank you for the detailed response, I really appreciate the time taken man. I tried this out and it sorted the situation out for me, so thank you very much!
Score:0
ci flag

I faced your same issue, turns out you just need to type in the password and be careful that you type it correct because it's invisible, and ubuntu will actually accept it!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.