Skip to content

Instantly share code, notes, and snippets.

@Digo
Last active November 17, 2022 08:45
Show Gist options
  • Save Digo/31c26563d08b3a9f7a7736e46001cea6 to your computer and use it in GitHub Desktop.
Save Digo/31c26563d08b3a9f7a7736e46001cea6 to your computer and use it in GitHub Desktop.
Setup SSH Server for WSL2
# check ssh availability
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
# Install SSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start the SSH Server
Start-Service sshd
Get-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
# Set login shell to WSL2 bash
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment