zocada

Using SSH in Windows PowerShell – Complete Installation Guide

Connecting to a remote server was always been a hassle for windows users. For several years we’ve been depending on PuTTY for the same purpose and it’s a pain setting up and using it. PuTTY is an SSH and TelNet client originally designed to give the functionalities that are built in on Linux terminals. Since the day Microsoft introduced PowerShell on latest updates in Windows 10, the game started changing slowly.

We’ll learn how to install OpenSSH client on our Windows 10 machine with PowerShell using Chocolatey, a Package Manager for Windows.

Requirements

Make sure you have latest version of Windows 10 [or Windows 7 / Windows Server 2003+] installed and PowerShell 2.0+ is available to fire up.



Installing Chocolatey on Windows

Open up your Windows PowerShell as Administrator by searching it on the start menu, right click and Run as Administrator.

Now, Paste the following command into PowerShell Window to start downloading Chocolatey. It will take a while to download the file and install it.

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Once the download is finished, Restart the environment to update the newly added environment variable. Paste the following command.

refreshenv

 

Installing OpenSSH in Windows

We’ll be installing the freely available and ready to download version of OpenSSH through the PowerShell using choco-tools. Make sure you are running the PowerShell with administrative previleages.

OpenSSH is the premier connectivity tool for remote login with the SSH protocol. It encrypts all traffic to eliminate eavesdropping, connection hijacking, and other attacks. In addition, OpenSSH provides a large suite of secure tunneling capabilities, several authentication methods, and sophisticated configuration options.

Copy paste the following choco command to start downloading and installing OpenSSH.

choco install openssh

Once the installation completes, Close the PowerShell and open it again. Type the ssh command to verify that the installation was successfull.

Now you can connect to your server using the standard ssh commands. If you get Host Key Verification failed error then use the following command to connect to the server only for the first time. This will add your host into the known hosts for future uses.

ssh -o StrictHostKeyChecking=no username@yourserver

For any further queries, visit the official website of OpenSSH and Chocolatey. Leave a comment if you need any help or if you ran into an error.


haxzie

Community Lead with a demonstrated history of working in a non-profit organization. Skilled in Python, Public Speaking, Graphic Design, Writing, and Android Development. Strong community and social services professional with a Bachelor's degree focused in Computer Science from Sahyadri College of Engineering and Management.