sodcalculator

10 Tech How-To

How to Use SSH in Windows 11

Guide 10-49741 · Updated · Step by step

SSH (Secure Shell) lets you securely connect to remote servers, manage devices, or transfer files from your Windows 11 PC without extra software. This guide shows you how to use the built-in OpenSSH client, generate keys, and troubleshoot common issues.

What You’ll Need

  • Windows 11 (version 21H2 or later)
  • Administrator access to enable the OpenSSH feature (if not already enabled)
  • The remote server’s hostname or IP address, and your username
  • Optional: a password or an SSH key pair for authentication

Step-by-Step

  1. Check if OpenSSH is installed – Open PowerShell or Command Prompt and type ssh. If you see a usage message, it’s ready. If you get “not recognized,” proceed to step 2.
  2. Enable OpenSSH Client – Go to Settings > Apps > Optional features. Click View features, search for “OpenSSH Client,” select it, and click Install. Alternatively, run PowerShell as Administrator and use: Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
  3. Open a terminal – Use PowerShell, Windows Terminal, or Command Prompt. Windows Terminal is recommended for better handling of SSH sessions.
  4. Connect to a server – Type ssh username@hostname (e.g., ssh admin@192.168.1.10). If the port isn’t 22, use -p port (e.g., ssh -p 2222 user@host).
  5. Accept the host key – On first connection, you’ll see a fingerprint prompt. Type yes and press Enter to trust the server.
  6. Enter your password – Type your password when prompted. It won’t show characters as you type – that’s normal.
  7. Run commands – Once connected, you’re in the remote shell. Type commands like ls, pwd, or whoami to test.
  8. Exit the session – Type exit or press Ctrl+D to disconnect.

Common Mistakes

  • Forgetting the username – Always include it as user@host, not just the host.
  • Using the wrong port – If the server uses a custom port, you must specify it with -p.
  • Typing the password blindly – SSH doesn’t echo dots or asterisks; just type and press Enter.
  • Not enabling the client – Many Windows 11 installs have it, but not all.
  • Using a command prompt that lacks SSH – Some older command prompts might not have it; use PowerShell or Windows Terminal.

Tips

  • Use SSH keys for passwordless login – Generate with ssh-keygen, then copy the public key to the server using ssh-copy-id (if available) or manually append to ~/.ssh/authorized_keys.
  • Create an SSH config file – In C:\Users\YourName\.ssh\config, you can define hosts, ports, and keys for quick connections.
  • Use Windows Terminal profiles – Set up a profile that opens SSH directly with a command line.
  • Keep your private key safe – Never share it; use a passphrase when generating keys.
  • Use ssh -v for verbose output – This helps debug connection issues.

Troubleshooting

If you can’t connect, check the following:

  • “Connection refused” – The server may not be running SSH (port 22 closed). Verify the service is active and the port is open.
  • “Permission denied” – Wrong password or key not accepted. Double-check your username and password, and ensure the server’s authorized_keys file has your public key.
  • “Host key verification failed” – The server’s key changed (e.g., after reinstall). Remove the old key from known_hosts using ssh-keygen -R hostname.
  • SSH not recognized – Reinstall the OpenSSH client via Optional Features or PowerShell.
  • Timeout – Firewall may be blocking outbound SSH. Allow port 22 in Windows Defender Firewall or your network firewall.

Frequently Asked Questions

Do I need to install anything to use SSH on Windows 11?

Most Windows 11 installations include the OpenSSH client. If not, enable it from Settings > Apps > Optional features.

How do I generate an SSH key pair on Windows 11?

Open PowerShell and run ssh-keygen. Follow the prompts to save the key (default location is C:\Users\YourName\.ssh\id_rsa) and optionally set a passphrase.

Can I use SSH to transfer files?

Yes, use scp (e.g., scp file.txt user@host:/path) or sftp for interactive transfers.

How do I change the default SSH port?

Use the -p option, e.g., ssh -p 2222 user@host. You can also set it in your SSH config file.

Why does my SSH connection drop after a while?

This is often due to idle timeout. You can keep the session alive by adding ServerAliveInterval 60 to your SSH config or using -o ServerAliveInterval=60.

Is SSH secure enough for daily use?

Yes, SSH encrypts all traffic. Use strong passwords or key-based authentication, and keep your private key protected.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →