One of the cool things about Windows, is that it can now, run Linux in a semi-native way.
Following this tutorial, you will be able to:
Enable WSL on your Windows machine (have Linux running as a program)
Set up SSH on Windows and be able to SSH into your machine
Set the default SSH shell to be Linux
This allows you to SSH into your Windows machine and use the Linux shell immediately, as if it is a Linux server.
In this tutorial we will install Ubuntu 20.04 LTS.
Step 1. Enable WSL on Windows
In Windows Powershell and paste the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Step 2. Install Linux Distro
In Windows Powershell and paste the following command:
curl.exe -L -o ubuntu-2004.appx https://aka.ms/wslubuntu2004
Rename-Item ubuntu-2004.appx ubuntu-2004.zip
Expand-Archive ubuntu-2004.zip ubuntu2004
Step 3. Set the Path Environment Variable
In Windows Powershell and paste the following command:
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")[System.Environment]::SetEnvironmentVariable("PATH", $userenv + "C:\Users\Administrator\ubuntu2004", "User")
Step 4. Enable SSH on Windows
In Windows Powershell and paste the following command:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Set-Service -Name ssh-agent -StartupType 'Automatic'
Set-Service -Name sshd -StartupType 'Automatic'
Get-Service ssh* | Start-Service
Step 5. Set default SSH Shell
In Windows Powershell and paste the following command:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force
At this stage, it is a goof idea to reboot your machine.
Step 6. Start Linux
In Windows Powershell and paste the following command:
cd ubuntu2004
.\ubuntu2004.exe
Finally
You may run your favorite bash commands as follows...
In Linux shell paste the following command:
sudo apt update && sudo apt upgrade
To SSH into your machine from another remote machine, you may:
ssh WindowsUserName@WindowsHostnameOrIp
Hint
You may now use SimpleBackups to backup your Windows machine!