Windows VPS & RDP

Install OpenSSH Server on Windows for SSH and SFTP

Install and start OpenSSH Server, connect over SSH, set PowerShell as the default shell, add admin SSH keys and copy files with SFTP.

IntermediateWindows server2 min read

OpenSSH Server lets you open a PowerShell or command prompt on your Windows server over SSH, and copy files with SFTP or scp, without a full Remote Desktop session. It is built into Windows Server 2019 and later and Windows 10/11.

1. Install the server

Open PowerShell as Administrator.

On Windows Server 2025, OpenSSH Server is already installed; skip to step 2.

On Windows Server 2019/2022 and Windows 10/11:

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

2. Start it and make it start at boot

PowerShell
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic
Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" | Select-Object Name, Enabled

If the firewall rule does not exist, create it:

PowerShell
New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server (sshd)" -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow

3. Connect from your computer

macOS, Linux and Windows 10/11 all include an SSH client:

Bash
ssh Administrator@203.0.113.25

4. Make PowerShell the default shell (optional)

SSH opens Command Prompt by default. To get PowerShell instead:

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

5. Use SSH keys for administrators

For accounts in the Administrators group, Windows reads keys from one shared file, not the user's own folder. Paste your public key into it and lock down its permissions:

PowerShell
Add-Content -Path "C:\ProgramData\ssh\administrators_authorized_keys" -Value "ssh-ed25519 AAAA...your-public-key... you@laptop"
icacls.exe "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F"

New to keys? Set up SSH keys explains how to create a key pair.

Warning: Port 22 attracts constant login attempts. Use keys and long passwords, and if you only connect from fixed addresses, restrict the rule: Set-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -RemoteAddress 198.51.100.10.

6. Copy files with SFTP

SFTP works as soon as sshd is running. Use scp from a terminal, or a graphical client such as WinSCP or FileZilla with protocol SFTP, port 22:

Bash
scp ./site.zip Administrator@203.0.113.25:C:/Users/Administrator/Desktop/

Troubleshooting

  • Connection refused: Get-Service sshd must show Running.
  • Key is ignored for an admin account: check the key is in administrators_authorized_keys and that the icacls command above was run.
  • Timed out: the firewall rule is missing or restricted to another IP.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.