What was --setdefaultuser?
- In earlier versions of WSL (especially legacy ones), Microsoft provided commands (or flags) such as
lxrun /setdefaultuser <user>to establish which Linux user would be the default when you launch a distro. - Later, for Store-installed distros (e.g. Ubuntu from Microsoft Store), the pattern became something like
distro.exe config --default-user <username>
What Changed / Why is --setdefaultuser Removed or Deprecated?
- Legacy Tools Phased Out: The
lxruntool is deprecated. Commands dependent on it (such as/setdefaultuser) are no longer supported in recent builds of Windows/WSL. - Uniform Configuration Approach: Microsoft moved toward more consistent and reliable configuration methods. Instead of ad-hoc flags, there is now an emphasis on either distro config commands or configuration files.
- Imported Distros: Distributions manually installed or imported (via
wsl --import) often lack the usual executable wrappers (likeubuntu.exe) that earlier versions used. This makes the olderconfig --default-userorlxrun-style commands non-functional.
What to Use Now
Here are the current, supported methods to set the default user in WSL:
| Scenario | Method |
|---|
| 1) Store-installed distro | Use <DistributionName> config --default-user <username> from PowerShell or CMD. E.g. ubuntu config --default-user alice. |
2) Imported distro or when config command-based method fails | Inside the Linux distro, edit /etc/wsl.conf (with root privileges) to include:[user]default=<username>Then terminate the distro ( wsl --terminate <distro>) or shutdown WSL (wsl --shutdown) for changes to take effect. |
| 3) WSL version ≥ 2.4.10 (later recent builds) | Some builds introduced a wsl --manage <distro> --set-default-user <username> command. |
Take note: (Scenario 1)
Windows only creates a .exe launcher (like Ubuntu.exe, Ubuntu-24.04.exe) for distributions installed from the Microsoft Store, not for custom imports (wsl –import).
How to Set the Default User using Scenario 2
1) Open your custom distro (it will log you in as root by default):
powershell
wsl -d Ubuntu24.04-Dev2
2) Inside the distro, edit (or create) the WSL config file:
bash
sudo nano /etc/wsl.conf
3) Add these lines:
ini
[user]
default=ice
4) Save and exit (Ctrl+O, Enter, Ctrl+X).
5) Back in PowerShell, shut down WSL completely so the change takes effect:
powershell
wsl --shutdown
6) Start your distro again:
powershell
wsl -d Ubuntu24.04-Dev2
7) You should now be logged in as ice automatically.
What to Watch Out For / Migration Tips
- Always check whether the user you want to set already exists in the distro; otherwise setting as default will fail.
- For imported distros, the
configor.exe-launcher might not exist. In this case,/etc/wsl.confis the primary reliable way. - After changing default user via config file, terminating the distro or shutting down WSL is required, otherwise the change might not take effect.

