TechBuzzPro

How to Enable and Configure SSH Server on Windows with OpenSSH

· 5 min read · Windows & PC

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can enable an SSH server on Windows 10 and 11 using the built-in OpenSSH feature. This allows you to securely manage your PC remotely via command line from another device, which is essential for developers, system administrators, and power users who need automated access or file transfer capabilities without third-party software.

What You'll Need

  • A Windows 10 (version 1809 or later) or Windows 11 machine.
  • An administrative account on that machine.
  • A local user account with a password set (SSH generally requires password authentication; blank passwords are often rejected by default for security reasons).
  • A client device (Linux, macOS, or another Windows PC) to connect from.

Step-by-Step

  1. Install the OpenSSH Server: Press Win + I to open Settings. Navigate to Apps > Optional features. Click the Add a feature button. In the search box, type "OpenSSH Server". Select it from the list and click Install. Wait for the installation to complete. Note: Menu labels may vary slightly depending on your Windows version.
  2. Start the SSH Service: Once installed, the service does not start automatically. Open PowerShell as Administrator (right-click the Start button and select Terminal (Admin) or Windows PowerShell (Admin)). Run the following command to start the service:
    Start-Service sshd
  3. Set the Startup Type: To ensure the SSH server starts every time your computer boots, change its startup type to Automatic. In the same Admin PowerShell window, run:
    Set-Service -Name sshd -StartupType 'Automatic'
  4. Configure Firewall Rules: Windows Defender Firewall usually creates rules automatically during installation, but it is critical to verify they exist. Run this command in Admin PowerShell:
    New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
    If this command fails because the rule already exists, proceed to the next step.
  5. Create an SSH Key (Optional but Recommended): For enhanced security, generate an SSH host key if one does not exist. Run:
    C:\ProgramData\ssh\ssh-host-keygen
    Accept the defaults when prompted. This creates the necessary keys in C:\ProgramData\ssh\.
  6. Verify the Service Status: Confirm everything is running correctly by checking the status of the SSH daemon. Run:
    Get-Service sshd
    The state should say "Running". If it says "Stopped," run Start-Service sshd again.
  7. Test the Connection: From a different computer on the same network, open a terminal and try to connect using your Windows username and the IP address of the Windows machine:
    ssh username@windows_ip_address
    Enter your Windows account password when prompted. If you see a welcome message or command prompt, the setup is successful.

Common Mistakes

The most frequent error is attempting to connect with a user account that has no password. OpenSSH on Windows rejects empty passwords by default. Ensure your user account has a strong password configured in Windows Settings > Accounts > Sign-in options.

Another common issue is firewall interference. Even if the rule was created automatically, some third-party antivirus software or strict corporate firewalls may block port 22. Always verify inbound rules for TCP port 22 are active.

Users often forget that the service does not start automatically after installation. If you reboot your PC and SSH stops working, you must manually restart the service or ensure the startup type is set to Automatic as described in Step 3.

Tips

Use Key-Based Authentication: Passwords can be brute-forced. Generate an SSH key pair on your client machine (ssh-keygen) and copy the public key to C:\Users\YourUsername\.ssh\authorized_keys on the Windows PC. This allows login without a password and is significantly more secure.

Change the Default Port: To reduce noise from automated bots scanning for SSH servers, consider changing the port in C:\ProgramData\ssh\sshd_config. Change Port 22 to something like Port 2222, restart the service, and update your firewall rule to allow the new port.

Keep OpenSSH Updated: Microsoft pushes security updates through Windows Update. Regularly check for updates to ensure you have the latest patches for the OpenSSH server component.

Troubleshooting

If you cannot connect, first verify the service is actually running by checking services.msc or using Get-Service sshd in PowerShell. If the service is stopped, start it and check the event logs for errors.

Check the Event Viewer for detailed SSH logs. Open Event Viewer, navigate to Applications and Services Logs > OpenSSH. Look for Error or Warning events that indicate why the connection was refused or authenticated failed.

If you receive a "Connection Refused" error, ensure your Windows IP address is correct and that you are not behind a restrictive NAT or router. Try pinging the Windows machine from the client to verify basic network connectivity before attempting SSH.

If authentication fails despite having the correct password, verify that the user account is not disabled and that the password meets complexity requirements. Also, check the sshd_config file in C:\ProgramData\ssh\ to ensure PasswordAuthentication yes is uncommented and set to true.

Frequently Asked Questions

Does Windows Home support SSH Server?

Yes, Windows 10/11 Home edition supports installing and running the OpenSSH Server feature just like Pro or Enterprise editions. The steps are identical.

Can I use SSH to transfer files?

Yes. While SSH itself is for remote shell access, you can use SFTP (SSH File Transfer Protocol) clients like WinSCP, FileZilla, or the command-line sftp tool to securely transfer files over the same connection.

Is it safe to leave the SSH server running?

It is reasonably safe if you follow best practices: use strong passwords, implement key-based authentication, keep Windows updated, and consider changing the default port or restricting access to specific IP addresses via firewall rules.

Why did my SSH connection drop immediately?

This is often caused by a firewall blocking the traffic or the SSH service crashing due to a configuration error. Check the Event Viewer under OpenSSH logs for specific error messages regarding config parsing or service crashes.

Do I need to install anything else on the client side?

No. Linux, macOS, and modern Windows versions all include native SSH clients pre-installed. You only need to install the server component on the Windows machine you wish to control.