DEV Community

Cover image for Reset Ubuntu Password on Windows
Kristen Kinnear-Ohlmann
Kristen Kinnear-Ohlmann

Posted on • Originally published at kristenkinnearohlmann.dev

Reset Ubuntu Password on Windows

This week, I wanted to check a Docker command within Docker itself. I have been working with the dockerd engine on my Windows WSL 2 installation. Although I had been working through the terminal in VS Code, I wanted to try using the Ubuntu shell.

I found I had 2 versions of Ubuntu installed, each with its own password, and later realized I needed to log into the WSL shell. I researched and located a helpful solution on Stack Exchange that I summarized for use again in the future.

Password Change Process

  • Using the Ubuntu shell, note the following:
    • The version of Ubuntu you are using (I had a previous install as well as Ubuntu 18.04 in WSL)
    • Your username
  • Close the Ubuntu shell
  • Open PowerShell as Admin and reset the Ubuntu config to log in as root
    • Ubuntu:
  ubuntu config --default-user root
Enter fullscreen mode Exit fullscreen mode
  • Ubuntu 18.04:
  ubuntu1804 config --default-user root
Enter fullscreen mode Exit fullscreen mode
  • Re-open the Ubuntu shell - you will be logged in as root
  • Execute the passwd command and follow the prompts; ensure you secure your new password in a password safe! Do not include angle brackets.
   passwd <username>
Enter fullscreen mode Exit fullscreen mode
  • Close the Ubuntu shell
  • Open PowerShell as Admin and reset the Ubuntu config to log in as your username. Do not include angle brackets.
    • Ubuntu:
  ubuntu config --default-user <username>
Enter fullscreen mode Exit fullscreen mode
  • Ubuntu 18.04:
  ubuntu1804 config --default-user <username>
Enter fullscreen mode Exit fullscreen mode
  • Log into Ubuntu and confirm the new password

I followed these steps for both versions of Ubuntu, and I was able to reset both passwords. Once I opened the WSL shell, I was able to use my Ubuntu 18.04 credentials to start dockerd and check the commands I needed.

Resources

Reset the password in Ubuntu/Linux Bash in Windows

Top comments (0)