Scratchpad

/etc/wsl.conf

Set the default user for a WSL2 instance

[user]
default=<string>

Enable localhostForwarding

[wsl2]
localhostForwarding=true

Remove Windows Path from WSL

[interop]
appendWindowsPath=false

Start WSL2 as a specific user

wsl -d <distro> -u <user>

Notes when creating from rootfs

Create a non-root user

# in Ubuntu, you'll be root by default
adduser username

# Do you want to be able to sudo?
usermod -aG sudo username

Within Windows Terminal, ctrl + , for settings. Select the wsl instance from the left pane and set the starting directory to //wsl$/distroname/home/username

Last updated

Was this helpful?