TechBuzzPro

Enable OpenSSH Server on Windows 11 – Quick Guide

· 6 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 turn on OpenSSH in Windows 11 by installing the optional feature and starting the service, then you can use SSH clients or host an SSH server without any third‑party software.

What You'll Need

  • A PC running Windows 11 (Pro, Enterprise or Home edition).
  • An account with local administrator privileges.
  • Internet access for Windows Update (optional but recommended).
  • Basic familiarity with PowerShell or Command Prompt.

Step‑By‑Step

  1. Open Settings. Press Win + I or click the Start button and select the gear icon.

    In Settings, navigate to Apps > Optional features. The exact wording may vary slightly between builds, but the path is the same.

  2. View optional features. Click View features (or Add a feature on some versions) at the top of the page.

    This opens a list of Microsoft‑provided optional components that can be installed on demand.

  3. Install the OpenSSH client. In the search box, type “OpenSSH Client”. Check the box next to it and click Install.

    The client is only about 2 MB and installs in seconds. It lets you run ssh from any command line.

  4. Install the OpenSSH server (optional). If you want your Windows machine to accept incoming SSH connections, repeat the previous step but search for “OpenSSH Server” and install it.

    Both client and server are separate optional features; you can install either one or both.

  5. Open PowerShell as Administrator. Right‑click the Start button, choose Windows Terminal (Admin) or search for PowerShell, right‑click and select Run as administrator.

    Administrative rights are required to start or configure the SSH services.

  6. Start the SSH server service. In the elevated PowerShell window type:
    Start-Service sshd

    If the service was not previously started, it will now be running and listening on port 22.

  7. Set the service to start automatically. To ensure SSH is available after a reboot, run:
    Set-Service -Name sshd -StartupType 'Automatic'

    This registers the service to launch at boot time.

  8. Allow SSH through the Windows Firewall. Execute the following command:
    if ((Get-NetFirewallRule -Name 'OpenSSH-Server-In-TCP') -eq $null) { New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (TCP-In)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 }

    The rule opens inbound TCP port 22 for the SSH server. If you only need the client, you can skip this step.

  9. Verify the service status. Run:
    Get-Service sshd

    The output should show Status : Running. If it says Stopped, re‑run Start-Service sshd and check the event log for errors.

  10. Test the client. Open a regular Command Prompt or PowerShell window (no admin needed) and type:
    ssh localhost

    You should be prompted for your Windows username and password. Accept the host key fingerprint when asked. A successful login proves both client and server are functional.

  11. Configure authorized keys (optional but recommended). To enable key‑based authentication, create a folder C:\Users\<YourUser>\.ssh and place your public key in a file named authorized_keys. Then set proper permissions:
    icacls $env:USERPROFILE\.ssh /inheritance:r /grant:r "${env:USERNAME}:(R,W)"

    This prevents Windows from rejecting the key because of overly permissive ACLs.

  12. Restart the service to apply key changes. Run:
    Restart-Service sshd

    Now you can connect from another machine using ssh <your‑user>@<windows‑ip> without a password.

Common Mistakes

Many users stumble on a few predictable pitfalls:

  • Skipping the firewall rule. Even with the service running, Windows will block inbound connections on port 22 unless the rule is created.
  • Running the client without installing the optional feature. The ssh command is not present in a fresh Windows 11 install; you must add the OpenSSH client first.
  • Using a non‑administrator PowerShell to start the service. Without elevation, Start-Service sshd fails silently, leaving the server stopped.
  • Incorrect file permissions on authorized_keys. Windows ACLs that grant "Everyone" full control cause the SSH daemon to ignore the file for security reasons.
  • Forgetting to set the service to Automatic. After a reboot, the SSH server will be stopped, leading users to think the installation failed.

Tips

  • Use ssh -v for verbose output when troubleshooting client connections; it shows each handshake step.
  • Keep Windows Update enabled; Microsoft occasionally releases security patches for the OpenSSH components.
  • If you need a non‑standard port, edit C:\ProgramData\ssh\sshd_config and change the Port line, then restart the service.
  • To limit which users can log in via SSH, add AllowUsers user1 user2 to sshd_config.
  • Consider disabling password authentication once keys are working: set PasswordAuthentication no in sshd_config for stronger security.

Troubleshooting

If SSH does not behave as expected, follow this escalation path:

  1. Restart the computer. A simple reboot clears transient service issues and reloads firewall rules.
  2. Check Windows Update. Install any pending updates, then repeat the installation steps for the OpenSSH features.
  3. Verify the service state. Run Get-Service sshd. If it shows Stopped, attempt to start it and note any error messages.

    Common error: "The service did not respond to the start or control request in a timely fashion" often indicates a missing firewall rule or corrupted configuration file.

  4. Inspect the SSH logs. Open Event Viewer > Windows Logs > Application and filter for source sshd. Look for entries such as "Failed password" or "Invalid user".

    Log entries give clues about permission problems or malformed sshd_config directives.

  5. Validate the firewall. Run netsh advfirewall firewall show rule name=all | findstr /i "OpenSSH". If the rule is missing or disabled, recreate it with the command shown in step 8.
  6. Test connectivity locally. Use telnet 127.0.0.1 22 or Test-NetConnection -ComputerName localhost -Port 22. A successful connection confirms the port is open.

    If the test fails, the issue is likely at the network or firewall layer.

  7. Re‑install the optional features. In Settings > Apps > Optional features, select OpenSSH Client and Server, click Uninstall**, then **Add a feature** again. This clears corrupted files.
  8. Reset the configuration file. Rename C:\ProgramData\ssh\sshd_config to sshd_config.backup and run ssh-keygen -A to generate a fresh default config. Restart the service afterward.
  9. Seek community help. Provide the exact error messages, OS build number, and a snippet of sshd_config (redacting passwords). Official Microsoft forums and GitHub issues for the OpenSSH Windows port are good resources.

Frequently Asked Questions

Do I need to download OpenSSH from the internet?

No. Windows 11 includes OpenSSH as an optional feature that can be installed directly from Settings or via PowerShell without external downloads.

Can I use the same SSH keys I have on Linux or macOS?

Yes. The OpenSSH client and server on Windows understand the standard OpenSSH key formats. Just copy your id_rsa or id_ed25519 files into C:\Users\<user>\.ssh.

Why does my SSH connection hang after entering the password?

Often this is caused by the Windows firewall still blocking the inbound connection or by a mismatched sshd_config setting such as UsePrivilegeSeparation. Verify the firewall rule and review the log for “authentication succeeded”.

Is the OpenSSH server safe for production use?

It provides the same security guarantees as the upstream OpenSSH project. Keep it updated via Windows Update and follow best practices: disable password auth, restrict users, and use strong key algorithms.

How do I change the default SSH port?

Edit C:\ProgramData\ssh\sshd_config, locate the line that reads #Port 22, remove the hash and replace 22 with your desired port number. Then run Restart-Service sshd and adjust the firewall rule accordingly.

Can I run both the client and server simultaneously?

Yes. The client and server are independent optional features. Installing both lets the same machine act as an SSH client for remote hosts while also accepting inbound SSH connections.