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.
- Intermediate
- Windows VPS · Admin RDP
- 2 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:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.02. Start it and make it start at boot
Start-Service sshd
Set-Service -Name sshd -StartupType Automatic
Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" | Select-Object Name, EnabledIf the firewall rule does not exist, create it:
New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server (sshd)" -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow3. Connect from your computer
macOS, Linux and Windows 10/11 all include an SSH client:
ssh [email protected]4. Make PowerShell the default shell (optional)
SSH opens Command Prompt by default. To get PowerShell instead:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force5. 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:
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.
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:
scp ./site.zip [email protected]:C:/Users/Administrator/Desktop/Troubleshooting
- Connection refused:
Get-Service sshdmust show Running. - Key is ignored for an admin account: check the key is in
administrators_authorized_keysand that theicaclscommand above was run. - Timed out: the firewall rule is missing or restricted to another IP.
Next steps
Was this guide helpful?
Still stuck?
Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.
Related guides
Windows VPS & RDP
RunRacks RDP port 12230: how to connect to your Windows VPS and Admin RDP
RunRacks Windows VPS and Admin RDP servers accept Remote Desktop on port 12230, not 3389. Here is how to connect from every device and keep the port open.
- Beginner
- Windows VPS · Admin RDP
- 5 min read
Windows VPS & RDP
Allow or block multiple RDP sessions for one user
Understand why a new Remote Desktop login takes over your old session, how the single-session policy works on Windows Server, and which setting suits a team.
- Advanced
- Windows VPS
- 5 min read
Windows VPS & RDP
Create Windows users with Remote Desktop access
Give each person their own Windows login, add them to Remote Desktop Users, test the account and remove access cleanly later.
- Beginner
- Windows VPS · Admin RDP
- 2 min read