Install OpenSSH under Windows 10 and set Powershell as default shell

Published on Author admin

Follow below steps for installation of OpenSSH server under Windows 10 OS.

List available OpenSSH software for installation:

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

Install OpenSSH client:

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Install OpenSSH server:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Start OpenSSH service:

Start-Service sshd

Enable autostart for OpenSSH service:

Set-Service -Name sshd -StartupType 'Automatic'

Check if TCP 22 port is enabled on Windows Firewall:

Get-NetFirewallRule -Name *ssh*

Set Powershell as default shell:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

You can now connect via SSH to your Windows machine.