How to Use SSH in Windows to Connect to a Remote Server

How to Use SSH in Windows to Connect to a Remote Server

To connect to and use SSH in Windows, you need to first install the OpenSSH client and run the following command:

ssh username@IPaddress

However, there are some requirements for it. For example, the SSH server should be active and running on the server, or the OpenSSH client must be installed on your Windows, and other factors.

Prerequisites to Use SSH in Windows to Connect to Remote Server

The prerequisites to use SSH in Windows 10/11 to connect to a remote server are:

  • A running OpenSSH server on the remote server, like a VPS
  • OpenSSH client installed on your Windows
  • The IP address of the server you want to connect to
  • The username and password configured for SSH and key pairs, if configured

How to connect to SSH server from Windows

To connect to and use SSH in Windows, we need to make sure of two things:

  1. OpenSSH is installed on the Windows 10/11
  2. The SSH server is running on the remote server

Here are the instructions to check the status above situations:

Step1: Installing OpenSSH on Windows 10/11

First, let’s check whether the OpenSSH client is installed on your Windows. Open the Powershell or cmd (by typing “PowerShell” in the search bar) and run the following command:


If the OpenSSH client is already installed, you will get this result:

running ssh command in powershell

If you get other results, it means the OpenSSH has not been installed. To add and install SSH on Windows, go to Settings>>System>>Optional features, then select “Add a feature”.

going to "optional features" section in windows

In the search bar, type “OpenSSH Client” and select it. The OpenSSH will be downloaded and installed on your Windows.

Installing the OpenSSH client

Step2: Check if the SSH server is running

Now that we have OpenSSH installed on our Windows, it is better to check the status of the remote SSH server. Log in to your remote server, open the terminal/command line and run:

In Linux server:

ssh localhost

If the machine asks for a key or password or prompts “Active: active (running )”, the SSH server is running.

Activating SSH server on Linux

In case SSH is already installed on your Linux server but is not running, run the following to enable SSH on linux:

sudo service sshd start

In Windows server:

Run this command in the PowerShell to check if the SSH server is running on the Windows server:

Get-Service -Name sshd

If the server is active, the Powershell will prompt:

Status: Running
Activating SSH on Windows server

If the SSH server is not running, type “services.msc” in the search bar. In the opened window, search for and double-click on the “OpenSSH SSH Server”. Head to the “General” tab and select “Automatic” from the “Startup type” drop-down menu.

Finally, to start the SSH server, select “Start”.

Step3: Connect to a remote server using SSH in Windows 10/11

In this step, all the prerequisites are met, and we can start connecting to the SSH server from Windows. To connect to the remote SSH server, open the Powershell and run:

ssh username@IPaddress

Put your username and IP address in the command above and run it to connect to the SSH server. The Powershell will ask for the password, so type it in, and you will be connected.

The Powershell may prompt you to confirm that you are sure to connect to the SSH server before typing the password. The prompt will be like:

The authenticity of host ‘IPaddress (’ can't be established.
ECDSA key fingerprint is SHA256:d0x9f87e3a80f8fd9b1bd267c746c8d6b5a4cc1fc47b4a9d0a84.
Are you sure you want to continue connecting (yes/no)?

Type “yes” to continue. Now, the PowerShell will show the username configured for the SSH server. This means you are connected to the SSH server.

How to connect to SSH in Windows 8/7/Vista/XP

Since PowerShell is not available in Windows 8 and earlier versions, you need to employ third-party SSH clients to connect to the remote SSH server.

Putty is one of the most user-friendliest SSH clients. We recommend you use Putty to connect to an SSH server.

How to connect to SSH in Windows using key pairs

If you are provided with the SSH server’s public and private keys, you can log in using these keys. The syntax to do so is:

ssh -i C:\Users\User/.ssh/id_rsa username@IPaddress

The “C:\Users\User/.ssh/id_rsa” is where your system’s private key is saved.

Step4: How to end an SSH session in Windows 10/11

when you are done working with the remote SSH server in Windows, you can easily terminate the session by typing this command:



Connection to closed.

How to run commands remotely on an SSH server from Windows

You may want to run commands over an SSH connection on your remote server. The syntax to do so is:

  • For a single command:
ssh username@IPaddress command1
  • For multiple commands:
ssh username@IPaddress "command1; command2; command3"

Remember to put and replace your username, IP address, and the command in the syntax.

How to change the SSH default port number when connecting

The SSH default port number is 22. In case your SSH server listens to another port, you can add the following to the connecting command to change the port:

-p (Portnumber)

Replace (Portnymber) with the SSH server port number. If, for example, the port number is 8045, the command should look like:

ssh username@IPaddress -p 8045

How to find Active SSH connections

If you are a network administrator that has a running SSH server on Linux or Windows server with multiple users and connections, you can find the active connections using this command:

powershell Get-NetTCPConnection -LocalPort 22 | Select-Object -ExpandProperty State

This command checks for active sessions on the SSH default port, which is 22. You can change it.

Also, you can find and view active SSH connections on Linux using simple commands.

How to open SSH on Windows

You can find and locate SSH on Windows by going to Settings>>Apps and Features>>Optional features. The OpenSSH client can be found there.

How to uninstall OpenSSH in Windows

Uninstalling SSH in Windows is very simple and can be done in three easy steps:

  1. Go to Settings>>Optional Features (or Manage optional features)
  2. Select OpenSSH Client
  3. Select Uninstall

Now, the OpenSSH client is uninstalled.


It may seem purely technical and very complicated, but to use SSH in Windows can be a simple process.

Everything you need to do is to check the status of the remote SSH server and OpenSSH client on your system, then run the specific command in Powershell to connect to the SSH server from Windows.

Leave a Reply

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