COMMAND
sshOpenSSH client for Windows
The ssh command is the OpenSSH client built into Windows 10 and 11. It opens an encrypted terminal session to a remote host on port 22, and also handles key authentication, port forwarding and running single remote commands. ssh -v shows the handshake for troubleshooting.
Purpose
ssh opens a secure, encrypted connection to a remote host: an interactive shell, a single command, or a tunnel carrying other traffic. Everything travels over port 22 inside SSH's encryption, so it is safe across untrusted networks. The concepts are in encryption in transit and authentication basics.
Connect
ssh [email protected]
ssh -p 2222 [email protected]The first time, ssh shows the server's host-key fingerprint and asks you to confirm; it is stored in %USERPROFILE%\.ssh\known_hosts.
Key authentication
ssh-keygen -t ed25519 -C "you@workstation"
type %USERPROFILE%\.ssh\id_ed25519.pub | ssh user@host "cat >> ~/.ssh/authorized_keys"
ssh -i %USERPROFILE%\.ssh\id_ed25519 user@hostKey authentication is stronger than passwords and required for automation. Private key files must have tight permissions or OpenSSH refuses them; the chmod calculator explains the Unix side, and on Windows the file must not grant read access to other users.
Run one command
ssh user@host "df -h && uptime"Port forwarding
ssh -L 5901:localhost:5900 user@host
ssh -L 3307:db-internal:3306 user@jump-hostThe first tunnels a local port 5901 to the remote host's VNC port; the second reaches a database (3306) that only the jump host can see. This is the safe way to reach services that should not be exposed directly.
Troubleshooting
ssh -v user@host-v (or -vv, -vvv) prints the negotiation: which key methods were tried, why authentication failed, the server version. Before blaming ssh, confirm the port is reachable:
Test-NetConnection host.example.com -Port 22See Test-NetConnection.
Common mistakes
- Loose key-file permissions. ssh ignores a private key other users can read.
- Confusing the client and server. The
sshcommand is the client; to accept incoming connections the machine needs the OpenSSH server feature installed and running. - Removing a known_hosts entry without verifying the new fingerprint, which defeats the protection against machine-in-the-middle attacks.
Frequently asked questions
Is ssh built into Windows?
Yes. The OpenSSH client ships with Windows 10 (from 1809) and Windows 11 and is enabled by default. The OpenSSH server is a separate optional feature. Run ssh -V to see the version.
How do I use a key instead of a password?
Generate a key with ssh-keygen -t ed25519, copy the public key to the server's ~/.ssh/authorized_keys, and connect with ssh -i C:\Users\you\.ssh\id_ed25519 user@host. On Windows the private key must not be readable by other accounts or ssh refuses it.
What does "REMOTE HOST IDENTIFICATION HAS CHANGED" mean?
The server presented a different host key than the one stored in your known_hosts. It can mean the server was legitimately rebuilt, or a machine-in-the-middle. Verify the new fingerprint out of band before removing the old entry.