Set Up SSH Server on Windows XP

SSH Server on Windows

Running an SSH server on Windows is useful for remote administration, setting up port forwarding, or integrating Windows machines into Unix-like workflows. Modern Windows provides native options that are simpler and better supported than legacy third-party solutions.

Using Windows Built-in OpenSSH

Windows 10/11 includes OpenSSH as an optional feature. This is the recommended approach for current systems.

Installation

Install OpenSSH Server through Settings:

  1. Open SettingsSystemOptional features
  2. Click Add an optional feature
  3. Search for “OpenSSH Server”
  4. Click Install

Alternatively, use PowerShell (run as Administrator):

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Configuration

OpenSSH stores its configuration in C:\ProgramData\ssh\sshd_config. Edit this file to customize behavior:

# Listen on port 22 (default)
Port 22

# Use password authentication or key-based auth
PasswordAuthentication yes
PubkeyAuthentication yes

# Default shell (PowerShell or cmd)
Subsystem powershell C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

For key-based authentication, place your public key in C:\Users\USERNAME\.ssh\authorized_keys (create the .ssh directory if it doesn’t exist).

Starting the Service

Enable and start OpenSSH Server:

Set-Service -Name sshd -StartupType Automatic
Start-Service -Name sshd

Verify it’s running:

Get-Service sshd

Firewall Configuration

Allow SSH through Windows Defender Firewall:

New-NetFirewallRule -Name sshd -DisplayName "OpenSSH Server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 22

Or enable it through SettingsPrivacy & SecurityFirewall & network protectionAllow an app through firewall.

Testing the Connection

From another machine (Linux, macOS, or Windows):

ssh username@windows-ip-address

You’ll receive a host key verification prompt on first connection. Accept it to add the host key to your local known_hosts file.

Legacy Approach: Third-Party SSH Servers

If you’re on older Windows versions (XP, Vista, Server 2003) with no native OpenSSH support, third-party solutions exist but are largely unmaintained:

  • Cygwin with OpenSSH: Download Cygwin and select the openssh package during installation. This provides a Unix-like environment with SSH support.
  • Bitvise SSH Server: A commercial option with a free version for personal use. It offers better Windows integration than legacy open-source tools.

These approaches require manual user/group configuration and careful firewall setup. For any current Windows version, native OpenSSH is superior.

Common Issues and Troubleshooting

Connection refused: Verify the service is running and the firewall rule exists.

netstat -ano | findstr :22

Permission denied (publickey): Ensure the .ssh directory and authorized_keys file have correct permissions. OpenSSH on Windows requires strict ownership rules.

Wrong shell launching: Modify sshd_config to specify your preferred shell (PowerShell, cmd, or bash if installed).

Key permissions too open: If using key-based auth, files in .ssh should only be readable by the user. Use:

icacls C:\Users\USERNAME\.ssh\authorized_keys /inheritance:r /grant:r "%USERNAME%:F"

Port Forwarding

SSH port forwarding works the same as on Linux. Create a reverse tunnel to expose a local service:

ssh -R 8080:localhost:3000 username@windows-ip-address

This binds port 8080 on the Windows machine to port 3000 on your local machine.

Similar Posts

3 Comments

  1. I know the street is back to you in your facebook photo
    It is a start of a long “hot” walking to the pnly Peak mount of Honk Kong
    The only “fresh” place of Honk Kong and on the top exist a wonderfull
    golf club restaraunt , where I haved a very good dinner a lot of years ago
    It is n’t ?

    1. Actually it in my University: HKUST. HKUST is built on the slope of a mountain facing the beautiful sea. On this photo, I was back to the sea and facing the mountain in the campus.

      The Peak is also a beautiful place in HK. I have been there twice but unfortunately I didn’t notice the golf club restaurant but just had dinner in a Chinese one.

Leave a Reply

Your email address will not be published. Required fields are marked *