Comments (3)
Ah, I read the docs: there's
wsl -u root
which partially helps. If, say, you generalized --root
to --user
which worked so that, given --user someone
, DistroLauncher runs useradd -m someone
instead of using adduser
then it won't prompt, and I can later use wsl -u root passwd someone
to set the password, or echo 'someone:pass' | wsl -u root chpasswd
to set it noninteractively.
from wsl-distrolauncher.
..and now I just noticed ubuntu1804 config --default-user username
. Which pretty much covers everything I want.
DistroLauncher could make this smoother maybe with more obvious flags, but this works fine:
<distro>.exe install --root
wsl -u root -d <distro> useradd -m "$username"
wsl -u root -d <distro> sh -c "echo "${username}:${password}" | chpasswd"
wsl -u root -d <distro> chsh -s /bin/bash "$username"
wsl -u root -d <distro> usermod -aG adm,cdrom,sudo,dip,plugdev "$username"
<distro>.exe config --default-user "$username"
from wsl-distrolauncher.
Or, this is even better:
Given that you've grabbted the .appx link for a distro:
$distro = "ubuntu1804"
$distro_link = "https://aka.ms/wsl-ubuntu-1804"
$username = "ubuntu"
$password = "ubuntu"
Invoke-WebRequest -Uri $distro_link -OutFile ~/${distro}.appx -UseBasicParsing
Add-AppxPackage -Path ~/${distro}.appx
& $distro install --root
& $distro run useradd -m "$username"
& $distro run sh -c "echo "${username}:${password}" | chpasswd"
& $distro run chsh -s /bin/bash "$username"
& $distro run usermod -aG adm,cdrom,sudo,dip,plugdev "$username"
& $distro config --default-user "$username"
from wsl-distrolauncher.
Related Issues (20)
- Wsl distrol luncher HOT 1
- 'HCS_E_HYPERV_NOT_INSTALLED': undeclared identifier HOT 3
- Building distro-launcher failing HOT 3
- Error:0x80070002 HOT 3
- Running build.bat builds both the x64 and ARM64 platforms HOT 1
- Cannot acquire developer license when installing sideload on another computer
- The root certificate of the signature in the app package must be trusted
- This repo is missing important files HOT 5
- Error code: Wsl/0x80070424
- WslRegisterDistribution failed with error: 0x80070057 HOT 1
- Solving building warnings
- Wrong output name for the message catalog
- Building on Linux / without Visual Studio?
- Is this maintained or planned to continue to be maintained?
- SignTool Error: An unexpected internal error has occurred.
- MakeAppx : error : 0x80080215 HOT 3
- Custom Distro CI/CD build using github workflow HOT 1
- Launcher cannot retrieve full subsystem settings. HOT 11
- Add `BuildTools` and Visual Studio 2022 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsl-distrolauncher.