Windows SSH Guide
Guide: Setting up SSH on Windows and Accessing it from Another Computer
1. Enable the OpenSSH Server on Windows (Server Machine)
Windows 10 (1809+) and Windows 11 come with OpenSSH built-in but not always enabled.
-
Open Settings
- Press
Win + I
→ Go to Apps → Optional features.
- Press
-
Install OpenSSH Server
- Scroll down and check if OpenSSH Server is installed.
- If not, click Add a feature → Search for OpenSSH Server → Install.
-
Start and Enable the SSH Service
- Open Services (
Win + R
, typeservices.msc
). - Find OpenSSH SSH Server.
- Right-click → Start.
- To make it auto-start on boot: Right-click → Properties → Set Startup type to Automatic.
- Open Services (
-
Check the Firewall
- Open PowerShell as Administrator and run:
Get-NetFirewallRule -Name *ssh*
- If needed, allow SSH explicitly:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
- Open PowerShell as Administrator and run:
2. Find Your Windows Machine’s IP Address
On the server machine, open Command Prompt or PowerShell and run:
ipconfig
- Look for your IPv4 Address (e.g.,
192.168.1.50
).
3. Connect from Another Computer (Client Machine)
From Linux / macOS
Open a terminal and run:
ssh username@192.168.1.50
- Replace
username
with your Windows account username. - Replace
192.168.1.50
with the Windows machine’s IP.
If prompted with a fingerprint warning → type yes. Enter your Windows password.
From Another Windows Computer
-
Open PowerShell.
-
Run:
ssh username@192.168.1.50
4. (Optional but Recommended) Set Up Key-Based Authentication
This avoids typing a password every time.
-
On Client Machine generate SSH keys:
ssh-keygen
- Press Enter to accept defaults → keys saved in
~/.ssh/id_rsa
.
- Press Enter to accept defaults → keys saved in
-
Copy the Public Key to Windows
- On the client, run:
(If
ssh-copy-id username@192.168.1.50
ssh-copy-id
isn’t available, just copy the contents of~/.ssh/id_rsa.pub
manually). - On the Windows server:
- Create directory (if not exists):
mkdir C:\Users\username\.ssh
- Paste your public key into a file called
authorized_keys
:notepad C:\Users\username\.ssh\authorized_keys
- Create directory (if not exists):
- Ensure permissions are correct:
icacls C:\Users\username\.ssh /inheritance:r icacls C:\Users\username\.ssh /grant "$($env:USERNAME):(R,W)"
- On the client, run:
-
Now you can log in without a password:
ssh username@192.168.1.50
5. (Optional) Access Over the Internet
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.
Join the Discussion