Installing and Enabling OpenSSH on Windows
  • 1 Minute to read
  • Dark
    Light
  • PDF

Installing and Enabling OpenSSH on Windows

  • Dark
    Light
  • PDF

Article Summary

  1. Prerequisites:
    • Ensure your device runs at least Windows Server 2019 or Windows 10 (build 1809).
    • Have PowerShell 5.1 or later.
    • Use an account that is a member of the built-in Administrators group.
  2. Validate Your Environment:
    • Open an elevated PowerShell session.
    • Type winver.exe to check your Windows version.
    • Run $PSVersionTable.PSVersion to verify PowerShell version.
    • Check if your account is part of the Administrators group with a specific PowerShell command.
  3. Install OpenSSH (GUI Method):
    • Go to Settings → System → Optional Features.
    • Check if OpenSSH is installed. If not, select Add a feature, then find and install both OpenSSH Client and Server.
    • Confirm OpenSSH is listed in Apps and Optional Features.
    • Open the Services app, find OpenSSH SSH Server, set its startup type to Automatic, and start the service.
  4. Install OpenSSH (PowerShell Method):
    • Run PowerShell as Administrator.
    • Check if OpenSSH is available using Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'.
    • Install the OpenSSH Client and Server using specific Add-WindowsCapability commands.
    • Start and configure the OpenSSH Server with Start-Service sshd and optionally set it to start automatically.
  5. Allowing SSH Port 22 in Windows Firewall:
    To ensure secure SSH communication, it's crucial to configure the Windows Firewall to allow traffic through port 22. Follow these steps:
    • Open Windows Defender Firewall: Search and open it from the Windows search bar.
    • Advanced Settings: Click on “Advanced settings” in the left pane.
    • New Inbound Rule: Under “Inbound Rules”, click “New Rule”.
    • Port Configuration: Select “Port”. Choose “TCP” and enter “22” as the specific port.
    • Allow Connection: Select “Allow the connection”.
    • Profile Selection: Choose the applicable profiles (Domain, Private, Public).
    • Naming the Rule: Name the rule (e.g., “SSH Port 22”) and provide a description. Finish by clicking “Finish”.

Was this article helpful?