Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019. In May 2019, WSL 2 was announced, introducing important changes such as a real Linux kernel, through a subset of Hyper-V features. Since June 2019, WSL 2 is available to Windows 10 customers through the Windows Insider program, including the Home edition.
Go to Windows features and activate “Windows Subsystem for Linux”
Afterwards go to the Microsoft Store, search for Linux and install a distribution of your choice
Start Linux via “Start → <Linux>” or type for example “ubuntu” via CLI
Configure your Linux for whatever you want. You can find various configs on my page.
Maybe start with Sudoers
#mount a local drive from your windows host on linux mkdir /drivez mount -t drvfs 'Z:' /drivez
Certain tasks like reboots cant be done inside Linux and need to be executed via Powershell
|wsl.exe –shutdown||Shutdown everything (Build 18917+)|
|wsl.exe -t <Distroname>||Terminate the session (Windows 1903+)|
|Restart-Service LxssManager||Restart the Manager (older Versions)|
|wsl.exe -l||List all Distros|
Open regedit, go to “Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\”
Inside your Distrofolder you will find “DefaultUid”, reset the value to your root UID (mostly 0).
Reopen your shell and you should be root.
After your rescue job is done, reset the value to your default users UID (mostly 1000)