WSL starts as root user be default.
Here’s how to ensure it runs as a “non-root user” (assumedly already created), which you then have to su and/or sudo <something> to act as root:
- either/and:
- modify a shortcut or change Windows Terminal’s Profile to set the distribution (if required) and the user name, and starting in the user’s home directory:
wsl -d <distro> -u <user> -cd ~
- edit
/etc/wsl.confto always start with a specific user:[user]
default=<user>
- modify a shortcut or change Windows Terminal’s Profile to set the distribution (if required) and the user name, and starting in the user’s home directory:
Simple! (Not!)
