Setting Up SSH Server and Opening Port 22 on Windows (2024)

Enabling SSH and opening port 22 on Windows involves setting up an SSH server on your Windows machine and configuring the firewall to allow inbound connections on port 22. One common way to achieve this is by using third-party software like OpenSSH for Windows.

Before setting up SSH on Windows and opening port 22, ensure the following:

Windows Version:

  • You must be using a compatible version of Windows that supports the OpenSSH feature. This typically includes Windows 10 version 1809 (October 2018 Update) or later, or Windows Server 2019.

Administrator Access:

  • You need administrative privileges on the Windows machine to install and configure the OpenSSH server and firewall rules.

Network Connectivity:

  • Ensure that your Windows machine is connected to a network, and you have a valid IP address assigned to it.

Windows PowerShell:

  • You should have basic familiarity with Windows PowerShell, as some steps involve running PowerShell commands as an administrator.

SSH Client (for remote access):

  • Prepare an SSH client on another device (e.g., PuTTY on Windows, OpenSSH on Linux/macOS) to connect to your Windows SSH server once it’s set up.

Enable OpenSSH Feature:

  • Open the “Settings” app on your Windows machine.
  • Go to “Apps” > “Optional features” > “Add a feature”.
  • Look for “OpenSSH Server” in the list and click to install it.

Install via PowerShell (if Settings app is not used):

  • Open PowerShell as Administrator.
  • Run the following command to install OpenSSH Server:
Add-WindowsCapability -Online -Name OpenSSH.Server

Start SSH Service:

  • Open PowerShell as Administrator.
  • Start the SSH server service:
Start-Service sshd

(Optional) Set SSH Service to Start Automatically:

  • Run the following command to set the SSH server service to start automatically:
Set-Service -Name sshd -StartupType 'Automatic'

Verify SSH Server Status:

You can check the status of the SSH server service to ensure it’s running:

Get-Service sshd
  1. Allow SSH Service:
  • Open PowerShell as Administrator.
  • Run the following commands to allow SSH traffic through the firewall:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22

Find Windows IP Address:

  • Open PowerShell.
  • Run:
ipconfig

Connect via SSH:

  • Use an SSH client on another machine (like PuTTY on Windows or OpenSSH on Linux/macOS).
  • In the SSH client, enter the Windows machine’s IP address and port 22 (default for SSH) to establish a connection.
ssh username@hostname_or_ip_address
  • Ensure that Windows Defender Firewall (or any other firewall software) is configured to allow inbound TCP traffic on port 22.
  • Use appropriate security practices, such as setting up SSH keys for authentication instead of passwords, to enhance security.
  • Always keep the Windows system and OpenSSH software up-to-date with the latest security patches.

By following these steps, you’ll have successfully enabled SSH and opened port 22 on your Windows machine, allowing you to securely connect to it using SSH clients from other devices on the same network.

Setting Up SSH Server and Opening Port 22 on Windows (2024)

FAQs

How do I enable port 22 for SSH in Windows? ›

Open Settings > Update and Security > For Developers . Click on the radio button for Developer mode ; this will open up your system's port 22 and allow the SSH broker to start listening for incoming connections. If you just switched to Developer mode , restart your computer, and then follow step 1 again.

Do I need to open port 22 for SSH? ›

Port 22 is the designated port for SSH, allowing devices to establish secure connections for remote administration and file transfer. It's important to note that port 22 must be open and accessible on the network for SSH connections to be established.

How do I fix SSH connect to host port 22 connection refused? ›

Here are some steps you can take to troubleshoot and fix an SSH “Connection Refused” error:
  1. Verify Your SSH Port. ...
  2. Check Your SSH Login Credentials. ...
  3. Ensure SSH Is Installed on the Server. ...
  4. Enable SSH Access on your Server. ...
  5. Resolve Server Firewall Conflicts with SSH.
Jun 19, 2024

How do I know if SSH port 22 is open on Windows? ›

Type the port you want to check (e.g., 22 for SSH) into the "Port to Check" box. Click Check Port. If the port is open and available, you'll see a confirmation message. If not, you'll see a message that says "Error: I could not see your service on (your IP address) on port (the port number)."

How to setup SSH on Windows? ›

Open the Windows 10 Start menu and search for “Apps & Features”. In the “Apps & Features” heading, click “Optional Features”. Scroll down the list to see if “OpenSSH Client” is listed. If not, click the plus sign next to “Add a feature”, select OpenSSH Client, and click “Install”.

How to check if SSH is enabled in Windows? ›

You can also check that it is present in Windows Settings > System > Optional features, then search for "OpenSSH" in your added features. For more information on configuring OpenSSH, see OpenSSH Server configuration for Windows.

How to fix the SSH connection refused error on Windows? ›

6 ways to fix the SSH connection refused error
  1. Change the SSH port number. ...
  2. Double-check the credentials. ...
  3. Make sure SSH is enabled. ...
  4. Make sure SSH client is installed. ...
  5. Ensure SSH Daemon is installed on the server. ...
  6. Check your firewall settings.
Jul 23, 2024

Why is my port 22 blocked? ›

Firewall restrictions

If a firewall on your local machine, within your network, or on the server is configured to block the SSH port (typically port 22), it will prevent an SSH connection. To resolve this, you need to adjust the firewall settings to allow traffic through the SSH port.

How do I change my SSH port to 22? ›

How to Change the SSH Server Port Number
  1. Use SSH to connect to your server and log in as root.
  2. Open the sshd_config file using a text editor. ...
  3. Identify the line specifying “Port 22” and change it to the port number you wish to use.
  4. Save changes when exiting the file editor.

Is port 22 open by default in Windows? ›

SSH port 22

By default, port 22 is open on all IBM StoredIQ hosts. The port is used for Secure Shell (SSH) communication and allows remote administration access to the VM. In general, traffic is encrypted using password authentication.

How to enable port in Windows? ›

How to open a port on the firewall
  1. Click on Start then on Control Panel.
  2. Click on Windows Firewall and then click on Advanced Settings.
  3. Right click on Inbound Rules then on New Rule:
  4. Select Port and click on Next:
  5. Enter a specific local port (e.g. 8080) and click on Next:
  6. Click on Next:
  7. Name the rule and click on Finish:
Jun 16, 2023

What port is SSH running on Windows? ›

You can get it through ipconfig command. As for the port, SSH runs normally on port 22 TCP, unless it's configured on a nonstandard port. If it's run on port 22, you don't need to indicate the port number in the command, otherwise you do. The default port for SSH on windows is port 22.

How do I enable SSH features in Windows? ›

Enable SSH client:
  1. Open 'Settings' > 'Apps' > 'Optional Features' and check if the OpenSSH client is installed - if needed, install it via 'Add optional feature'
  2. Open command prompt as administrator with Windows search > 'cmd.exe' > 'Run as administrator'
  3. Enter CMD command: ssh.
Oct 6, 2023

How to specify port in SSH Windows? ›

How to Change the SSH Server Port Number on Windows in 2022
  1. Click the Start button at the bottom left corner of your screen.
  2. Click RUN.
  3. Type REGEDIT.
  4. Click OK.
  5. Select Registry Key: ...
  6. Select the menu item Edit and then click on Modify.
  7. Enter the new value for the usGSWSSHDPort and click OK.

Top Articles
How Does Debt Collection Work? - Experian
Credit Dispute Resolution | Meaning, Process, & Legal Options
Couchtuner The Office
Nwi Police Blotter
Doublelist Paducah Ky
Seething Storm 5E
Joe Gorga Zodiac Sign
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
What is a basic financial statement?
Richmond Va Craigslist Com
Urban Dictionary Fov
The most iconic acting lineages in cinema history
Top tips for getting around Buenos Aires
Samsung Galaxy S24 Ultra Negru dual-sim, 256 GB, 12 GB RAM - Telefon mobil la pret avantajos - Abonament - In rate | Digi Romania S.A.
D10 Wrestling Facebook
"Une héroïne" : les funérailles de Rebecca Cheptegei, athlète olympique immolée par son compagnon | TF1 INFO
Khiara Keating: Manchester City and England goalkeeper convinced WSL silverware is on the horizon
Convert 2024.33 Usd
Roll Out Gutter Extensions Lowe's
Honda cb750 cbx z1 Kawasaki kz900 h2 kz 900 Harley Davidson BMW Indian - wanted - by dealer - sale - craigslist
Craigslist West Valley
I Saysopensesame
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Finalize Teams Yahoo Fantasy Football
Afni Collections
Dell 22 FHD-Computermonitor – E2222H | Dell Deutschland
Ts Modesto
How To Improve Your Pilates C-Curve
Experity Installer
Inmate Search Disclaimer – Sheriff
Bozjan Platinum Coins
Newcardapply Com 21961
Everything You Need to Know About NLE Choppa
Gold Nugget at the Golden Nugget
AI-Powered Free Online Flashcards for Studying | Kahoot!
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Uc Santa Cruz Events
Flags Half Staff Today Wisconsin
Omaha Steaks Lava Cake Microwave Instructions
Wilson Tattoo Shops
Firestone Batteries Prices
California Craigslist Cars For Sale By Owner
Saline Inmate Roster
Dr Mayy Deadrick Paradise Valley
The Great Brian Last
Unblocked Games - Gun Mayhem
Mega Millions Lottery - Winning Numbers & Results
Scott Surratt Salary
Craigslist Pets Lewiston Idaho
Fishing Hook Memorial Tattoo
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 5623

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.