Windows SSH Server Setup Documentation

This guide explains how to install, configure, and access the OpenSSH Server on Windows. It uses a VS Code–style theme for commands and includes professional explanations and examples.

Introduction

Windows includes a built-in OpenSSH Server capability. Using this, administrators can remotely access PowerShell, CMD, files, and system management functions securely over SSH.

This documentation covers installation, service configuration, firewall settings, obtaining the IP address, and connecting from Linux.

1. Check if OpenSSH Server is Installed

The following command checks whether the OpenSSH Server capability exists on the system, and whether it is installed or not.

# Check OpenSSH Server availability
Get-WindowsCapability -Online | ? Name -like "OpenSSH.Server*"

# Output explanation:
# State: Installed → SSH server already available
# State: NotPresent → Must be installed manually

2. Install OpenSSH Server

If SSH server is not installed, run the command below to install it from Windows optional features.

# Install OpenSSH Server (Windows capability)
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

# After installation the SSH service becomes available as 'sshd'.

3. Start & Enable SSH Server

Once installed, the SSH server must be started manually the first time, and then configured to start automatically at boot.

# Start SSH server immediately
Start-Service sshd

# Enable SSH server on system startup
Set-Service -Name sshd -StartupType 'Automatic'

4. Enable SSH Agent (Optional)

The SSH agent stores private keys securely in memory, allowing key-based authentication without typing passwords repeatedly.

# Start the SSH authentication agent
Start-Service ssh-agent

# Enable automatic start on boot
Set-Service ssh-agent -StartupType Automatic

5. Allow SSH Through Windows Firewall

By default Windows blocks inbound SSH on port 22. This command creates a firewall rule allowing external connections.

# Allow SSH (port 22) through Windows Firewall
New-NetFirewallRule -Name sshd -DisplayName "OpenSSH Server" ` -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

# After this, remote SSH clients can reach the Windows machine.

6. Get Windows IP Address

The IP address is required for connecting from external machines. Use the command below to list all network interfaces.

# Show network information
ipconfig

# Look for the IPv4 Address under your active network adapter.

7. Connect from Linux via SSH

Once the Windows SSH server is running and firewall is configured, Linux (or macOS) clients can connect using the standard SSH command.

# SSH command format
ssh username@IP_ADDRESS

# Example
ssh your_username@192.168.x.x

8. Full SSH Example

A complete working command for accessing a Windows machine from Linux:

ssh Pontio@192.168.1.5

# Once connected, you will be logged into a Windows PowerShell session over SSH.