Last active
November 17, 2022 08:45
-
-
Save Digo/31c26563d08b3a9f7a7736e46001cea6 to your computer and use it in GitHub Desktop.
Setup SSH Server for WSL2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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