In this guide, you will learn how to install and use OpenSSH Client on Windows.
PuTTY has been a popular ssh client for windows for a long time, probably because Windows had no native or built-in client.
But did you know? OpenSSH client was added to Windows 10 and Windows Server in the 2018 autumn build. There is a good chance you already have it installed.
How to Check if OpenSSH is Installed
To check if you already have the OpenSSH client installed, click the “Start” button, type cmd in the search box, and click on “Command Prompt”.
At the command prompt type ssh and press enter. If you get a list of command switches this means the client is installed.
If you get a message that the command is not recognized this means it is not installed. See the install steps in the next section
How to Install OpenSSH Client on Windows
To install OpenSSH click the “start” button and type features in the search box. Then click on “Apps & features”
Click on “optional features”.
Click on “Add a feature”
Next, type OpenSSH in the box, select the “OpenSSH Client” or the “OpenSSH Server” (or both), and click the install button. I already have the OpenSSH client installed so it doesn’t show up as an option for me.
How to Use OpenSSH client on Windows
Below is the basic syntax for using OpenSSH to connect to a remote device. You can use the IP address or hostname of the remote device.
I’ll demonstrate this by connecting to a Cisco switch with the IP of 192.168.40.1, and the username matt.
I will be prompted to accept the fingerprint, I will type yes. I will then be prompted for my password. After entering the password I’m connecting to the switch.
For internal devices that have no internet access, password access is ok. If the device is exposed to the internet it is highly recommended that you use SSH keys instead of passwords. Devices with public IPs will be constantly scanned and attacked, and passwords can easily be exploited or guessed.
SSH keys are much more secure and help to prevent unauthorized SSH access to your device. See my complete guide on How to configure SSH Public Key Authentication on Windows.
Uninstall OpenSSH Client
To uninstall the OpenSSH client, use the below command.
# Uninstall the OpenSSH Client Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
How to clear the known hosts file
If you need to clear a host from the known hosts file open the “Known_hosts” file from your profile with notepad and remove the entry.
This file will be userprofile path (c:\users\username\.ssh\).
I’ve connected to the “192.168.40.4” host, this is what my entry looks like.
If I deleted this and reconnected I would be prompted to accept the fingerprint again. There may be times when an entry needs to be removed and this is where that is done.