Turns out there’s another command simply called wsl
that lets you run arbitrary commands as arbitrary users:
>wsl -u root -d Ubuntu-18.04 -- echo "I am g$USER"
I am groot
N.B. you need to use separate args (instead of a string) for this one.
-d
is optional. You can change the default distro like
wslconfig.exe /l
wslconfig.exe /s Ubuntu-18.04
wslconfig.exe /l
wslconfig /l
appears to be equivalent to wsl --list