-
Notifications
You must be signed in to change notification settings - Fork 397
Open
Description
It would be nice if, instead of
If you are using WSL there's a followup step we recommend after running the setup script. When the script finishes you will only have a root user with a blank password. You should manually create a non-root user via $ sudo adduser [USERNAME] sudo with a non-blank password. Use this user going forward. For more info on WSL please refer to the documentation.
there was a way to auto-install with a regular user. I've opened an issue about this 'upstream': microsoft/WSL-DistroLauncher#90, but there's a workaround that maybe you could apply temporarily: microsoft/WSL#3369 (comment):
$username = "ubuntu"
$password = "ubuntu"
ubuntu1804 install --root
wsl -u root useradd -m "$username"
wsl -u root sh -c "echo "${username}:${password}`n" | chpasswd" # wrapped in sh -c to get the pipe to work
wsl -u root chsh -s /bin/bash "$username"
wsl -u root usermod -aG adm,cdrom,sudo,dip,plugdev "$username"
$uid = (wsl -u root id -u $username)
$distro = (Get-ItemProperty -Path Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss -Name DefaultDistribution).DefaultDistribution
$cur_id = (Get-ItemProperty -Path Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss\$distro -Name DefaultUid).DefaultUid
Set-ItemProperty -Path Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Lxss\$distro -Name DefaultUid -Value $uid
With this, you can just say
If you are using WSL take note that the login is "ubuntu:ubuntu".
Metadata
Metadata
Assignees
Labels
No labels