How to sign into "root" account by default on Windows Subsystem for Linux Bash terminal

In a command prompt with elevated permissions run the command lxrun /setdefaultuser root

lxrun is the tool for performing administrative operations on the LX subsystem.


The command to set the default Linux user is different in different versions of Windows.

For versions of WSL up to the Fall Creators Update, run the following command in an elevated Windows command prompt:

lxrun /setdefaultuser root

For installations after the Fall Creators Update, the command is:

<distro> config --default-user root

Substitute the distro's exe name for <distro> in the command above. So, if you're running Ubuntu, the command would be:

ubuntu config --default-user root

For openSUSE...

opensuse-42 config --default-user root

And, for SUSE Linux Enterprise Server, the command is...

sles-12 config --default-user root

Again, all of these commands are performed from an elevated Windows command prompt.

Note:
The examples above are for the root user. You may specify any other existing username in place of root.


Use

ubuntu1604 config --default-user root & ubuntu1604.exe

I tried the solutions mentioned above but somehow I always end up with the user login rather than root