Set Ubuntu user password in Windows 10

As I tried to make sudo command from my Ubuntu 18.04 running inside Windows 10 (Yes you can get Ubuntu running inside Windows 10 from the Microsoft Store! Awesome!), I realized I didn't set any password to my current user, which is needed to run a sudo command.

So, to do that, you first have to know you current Ubuntu username (asked when you install Ubuntu from the Microsoft store). Suppose your user is alex. We will do :

  1. Switch current Ubuntu user to root. To do that, open a Windows 10 Command or Powershell console and run :  ubuntu1804 config --default-user root
  2. Open your Ubuntu App (from the Windows 10 start menu). This will open Ubuntu bash in root instead of your user
  3. Run 'passwd alex' to set alex password and close your Ubuntu shell
  4. Switch Ubuntu back to alex as default user by running the following command from your current Windows 10 Command or Powershell console :  ubuntu1804 config --default-user alex
That's all. When you will start again Ubuntn App, you will be logged as you current user with the password you know and you will be able to do sudo commands.

Popular posts from this blog

DCcduino usb drivers (CH340 / CH341 chipset)

Use Spring profiles and yaml configuration without Spring Boot

The great alternative to JRebel