microsoft / microsoft/WSL

Add an option for "UNIX username" and "password" to WSL CLI

Open
#10,386 9 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature question
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

When running
`wsl --install Debian`

User is required to provide username and password:
```
Enter new UNIX username: jr
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
```
I would like to be able to run `wsl --install` in a noninteractive mode (as a part of a script).

**Describe the solution you'd like**
Add sub-options `--install-username` and `--install-password` to `wsl --install` command. The expected usage would be:
`wsl --install Debian --install-username jr --install-password 1234`

**Describe alternatives you've considered**
There are some awkward ways that this can be done in PowerShell e.g. https://superuser.com/questions/1569186/unattended-wsl-ubuntu-18-04-installation-from-powershell, but I don't want to maintain 40 line script for such a simple task.

**Additional context**
I am installing a configuring WSL as a part of an automatic Ansible-like init script here:https://github.com/jan-revay/initPC_Windows (so that every time I get a new machine, I don't have to configure it manually), but as WSL is not capable of being installed in a non-interactive mode - the script stops executing during WSL install (see: ). I would like the script to be fully non-interactive, so I can start it and come to a fully configured machine in 45 minutes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the referenced wsl_install.ps1 and the current `wsl --install` command path; the issue names no repository file or test. Check how noninteractive installation currently handles username and password, with completion meaning the requested options are accepted without prompts and the script-driven install finishes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.