Windows 10 (1809+) and Windows 11 come with OpenSSH built-in but not always enabled.
Open Settings
Win + I → Go to Apps → Optional features.Install OpenSSH Server
Start and Enable the SSH Service
Win + R, type services.msc).Check the Firewall
Get-NetFirewallRule -Name *ssh*
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
On the server machine, open Command Prompt or PowerShell and run:
ipconfig
192.168.1.50).Open a terminal and run:
ssh username@192.168.1.50
username with your Windows account username.192.168.1.50 with the Windows machine's IP.If prompted with a fingerprint warning → type yes. Enter your Windows password.
Open PowerShell.
Run:
ssh username@192.168.1.50
This avoids typing a password every time.
On Client Machine generate SSH keys:
ssh-keygen
~/.ssh/id_rsa.Copy the Public Key to Windows
ssh-copy-id username@192.168.1.50
(If ssh-copy-id isn't available, just copy the contents of ~/.ssh/id_rsa.pub manually).mkdir C:\Users\username\.ssh
authorized_keys:
notepad C:\Users\username\.ssh\authorized_keys
icacls C:\Users\username\.ssh /inheritance:r
icacls C:\Users\username\.ssh /grant "$($env:USERNAME):(R,W)"
Now you can log in without a password:
ssh username@192.168.1.50
If you want to connect from outside your local network:
Log in to your router and port-forward TCP port 22 to your Windows machine's IP.
Find your public IP (e.g., visit whatismyip.com).
From the client:
ssh username@<your-public-ip>
⚠️ Security Warning: Exposing SSH directly to the internet can be risky. Change the port, use key-based authentication, or set up a VPN for safety.