WSL Tips and Tricks
Reset Root User's Password
- Open PowerShell, then use the
wsl -u root
command to change the password. - At the prompt, enter
passwd <username>
where<username>
is the account to change the password of, (e.g.passwd james
). - Enter your password twice as prompted. It will not show in the terminal.
The password is now changed! Here's an example session using the username current_user
:
PS C:\> wsl -u root
[email protected]:/mnt/c/Users/current_user/# passwd current_user
Enter new UNIX password:
Retype new UNIX password:
passwd: updated successfully
[email protected]:/mnt/c/Users/current_user/# exit
logout
PS C:\>
Fix connection issues while on VPN
Based on this comment, the following instructions worked for me on Ubuntu Linux:
In your WSL Linux instance, create or edit /etc/wsl.conf
to look like this:
[network]
generateResolvConf = false
Back in Windows, restart WSL using PowerShell:
wsl --shutdown
wsl
In your WSL Linux, create or edit /etc/resolv.conf
to have the following entry (you may or may not have to delete other entries to get it working):
nameserver 8.8.8.8
Restart WSL again:
wsl --shutdown
wsl
Finally, once connected to the VPN, run the following command in Windows PowerShell:
Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect"} | Set-NetIPInterface -InterfaceMetric 6000
Broader Topics Related to Windows Subsystem for Linux (WSL)
Linux
A free and open-source operating system
Microsoft Windows
The Microsoft Windows Operating System