---
# System prepended metadata

title: Install OpenSSH Server on Windows 10
tags: [Windows]

---

---
title: Install OpenSSH Server on Windows 10
tags: Windows
---

# Install OpenSSH Server on Windows 10


## Install OpenSSH Server

### On Windows 10 version 1803 and newer

- In Settings app, go to Apps > Apps & features > Manage optional features.
- Locate “OpenSSH server” feature, expand it, and select Install.


Binaries are installed to ``%WINDIR%\System32\OpenSSH``. Configuration file (sshd_config) and host keys are installed to ``%ProgramData%\ssh`` (only after the server is started for the first time).

You may still want to use the following manual installation if you want to install a newer version of OpenSSH than the one built into Windows 10.

### On earlier versions of Windows

- Download the latest [OpenSSH for Windows binaries](https://github.com/PowerShell/Win32-OpenSSH/releases) (package OpenSSH-Win64.zip or OpenSSH-Win32.zip)
- As the Administrator, extract the package to C:\Program Files\OpenSSH
- As the Administrator, install sshd and ssh-agent services:

```bash=
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
```


## Configuring OpenSSH Server
```bash=
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'
# Confirm the Firewall rule is configured. It should be created automatically by setup.
Get-NetFirewallRule -Name *ssh*
# There should be a firewall rule named "OpenSSH-Server-In-TCP", which should be enabled
# If the firewall does not exist, create one
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
# Set default shell
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
```


## Reference

- https://winscp.net/eng/docs/guide_windows_openssh_server
- http://fygul.blogspot.com/2020/11/windows-openssh-server.html
- https://docs.microsoft.com/zh-tw/windows-server/administration/openssh/openssh_install_firstuse
- 