> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Enable OpenSSH Server on Windows Server

> Enable OpenSSH Server on Windows Server: built into 2025 (Remote SSH Access), or Add-WindowsCapability on 2019/2022, then start sshd and allow port 22.

To enable OpenSSH Server on Windows Server 2025, open **Server Manager > Local Server** and set **Remote SSH Access** to **Enabled**, or run `Start-Service sshd` and `Set-Service -Name sshd -StartupType 'Automatic'`. On Windows Server 2019 and 2022, install it first with `Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0`. The firewall rule `OpenSSH-Server-In-TCP` allows port 22, and you then connect with `ssh alex@203.0.113.10`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 minutes | Windows Server 2019 / 2022 / 2025 | Administrator account, PowerShell 5.1 or later |

## Before you start

* Sign in as an administrator with [Remote Desktop](https://help.freakhosting.com/portals/other/how-to-connect-to-windows-server-with-remote-desktop.md).
* Open PowerShell as administrator: select **Start**, type `PowerShell`, right-click **Windows PowerShell** and choose **Run as administrator**.
* SSH (Secure Shell) gives you an encrypted command line on the server, the same way you manage Linux servers. It's handy for scripts, file copies with `scp` and quick admin tasks without a full Remote Desktop session.

## How to enable OpenSSH Server on Windows Server 2025

OpenSSH Server is installed by default on Windows Server 2025; you only need to turn it on ([Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse)).

> [tab] Server Manager
>
> **1. Open Local Server**
>
> In **Server Manager**, select **Local Server** in the left pane.
>
> **2. Turn on Remote SSH Access**
>
> In **Properties**, find **Remote SSH Access** and select **Enabled**.

> [tab] PowerShell
>
> ```powershell theme={null}
> Start-Service sshd
> Set-Service -Name sshd -StartupType 'Automatic'
> ```
>
> The second line makes SSH start again after every reboot.

## How to install OpenSSH Server on Windows Server 2019 and 2022

**1. Check whether it's available**

```powershell theme={null}
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
```

`State : NotPresent` means it isn't installed yet.

**2. Install it**

```powershell theme={null}
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
```

The output shows `Online : True` and `RestartNeeded : False`.

**3. Start sshd and set it to start automatically**

```powershell theme={null}
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
```

On Desktop Experience you can also install it from **Start**: type `Optional Features`, select **Add an optional feature**, then **Add a feature** and install **OpenSSH Server**.

## How to check the firewall rule

Installing OpenSSH Server creates and enables the firewall rule `OpenSSH-Server-In-TCP` for inbound TCP port 22. This command, from Microsoft's documentation, checks for it and creates it if it's missing:

```powershell theme={null}
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}
```

If you use the [Firewall panel](https://help.freakhosting.com/portals/firewall/firewall-panel-overview.md), allow TCP 22 there as well, ideally only from your own IP.

> [!WARNING]
>
> SSH on port 22 is scanned and attacked constantly, exactly like RDP. Use strong passwords or, better, SSH keys, and consider limiting the rule to your IP: `Set-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -RemoteAddress 198.51.100.25`. Keep Remote Desktop or the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) working while you change SSH settings.

## How to connect

From Windows 10/11, macOS or Linux:

```bash theme={null}
ssh alex@203.0.113.10
```

Type `yes` the first time to trust the server's key, then enter the Windows password for `alex`. By default you land in Command Prompt (`cmd.exe`); type `powershell` to switch.

## How to make PowerShell the default SSH shell

The default shell is set in the registry value `DefaultShell` under `HKLM:\SOFTWARE\OpenSSH` ([Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh-server-configuration)):

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

New SSH sessions now open in PowerShell.

## How to log in with an SSH key

Where the public key goes depends on the account:

| Account | File for the public key |
| - | - |
| Standard user (`alex`) | `C:\Users\alex\.ssh\authorized_keys` |
| Member of **Administrators** | `C:\ProgramData\ssh\administrators_authorized_keys` |

For administrators, the file must only be accessible to **Administrators** and **SYSTEM**. After adding your public key, set the permissions:

```powershell theme={null}
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"
```

See [create and use SSH keys](https://help.freakhosting.com/portals/other/how-to-create-and-use-ssh-keys.md) for making a key pair. Settings live in `C:\ProgramData\ssh\sshd_config`; restart the service with `Restart-Service sshd` after any change.

## How to check it worked

```powershell theme={null}
Get-Service sshd
Get-NetTCPConnection -LocalPort 22 -State Listen
```

`sshd` shows `Running` and port 22 shows a listening entry. Then connect from your own computer.

## Frequently asked questions

### How do I set it up on Server Core?

Use the PowerShell commands on this page there: they don't need Server Manager or any other desktop tool.

### Who can sign in over SSH?

By default, local accounts can sign in with their Windows password. To restrict access, use `AllowUsers` or `AllowGroups` in `sshd_config`. On Windows Server 2025 you can also add the allowed users to the **OpenSSH Users** group.

### How do I turn SSH off again?

```powershell theme={null}
Stop-Service sshd
Set-Service -Name sshd -StartupType 'Disabled'
Disable-NetFirewallRule -Name 'OpenSSH-Server-In-TCP'
```

On Windows Server 2025 you can instead set **Remote SSH Access** to **Disabled** in Server Manager.

### Can I change the SSH port on Windows?

Yes, with a `Port` line in `C:\ProgramData\ssh\sshd_config`. Allow the new port in Windows Firewall first, then restart `sshd`, and test before closing your current session. The same order is explained in [change the SSH port](https://help.freakhosting.com/portals/other/how-to-change-the-ssh-port.md).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Create and use SSH keys](https://help.freakhosting.com/portals/other/how-to-create-and-use-ssh-keys.md)
>
> Safer than passwords.

> [card] [Copy files with scp and rsync](https://help.freakhosting.com/portals/other/how-to-copy-files-with-scp-and-rsync.md)
>
> Transfer files over SSH.

> [card] [PowerShell on Windows Server](https://help.freakhosting.com/portals/other/how-to-use-powershell-on-windows-server.md)
>
> What to do once connected.

> [card] [Open a port in Windows Firewall](https://help.freakhosting.com/portals/other/how-to-open-a-port-in-windows-firewall.md)
>
> Limit SSH to your IP.

***

> [!NOTE]
>
> **Checked against Microsoft Learn: [Get started with OpenSSH for Windows](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse), [OpenSSH server configuration](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh-server-configuration), [key-based authentication](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement) and [What's new in Windows Server 2025](https://learn.microsoft.com/en-us/windows-server/get-started/whats-new-windows-server-2025)** on 4 November 2026. Not tested on a live Windows server for this page.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.