Skip to content

Instantly share code, notes, and snippets.

@dterracino
Forked from richardszalay/Reset-BashPassword.ps1
Created October 4, 2020 14:43
Show Gist options
  • Save dterracino/a919607713b06faceb282cbaf86dc2b9 to your computer and use it in GitHub Desktop.
Save dterracino/a919607713b06faceb282cbaf86dc2b9 to your computer and use it in GitHub Desktop.
Reset-BashPassword.ps1
# Resets the password for the default LXSS / WSL bash user, based on https://askubuntu.com/a/808425/697555
$lxssUsername = (Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss).DefaultUsername
lxrun /setdefaultuser root
bash -c "passwd $lxssUsername"
lxrun /setdefaultuser $lxssUsername
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment