openssh on windows

Remote Into Other Computers - OpenSSH on Windows

Remote Into Other Computers - OpenSSH on Windows

If you manage both Windows and Linux in your environment (which almost everyone does) why would you want to use more than one method to remotely manage computers?

The correct answer is, you shouldn’t. Most PowerShell users currently use WS-Management for remoting into their Windows machines, but this is a protocol used primarily in Windows. With SSH, you can remote into any operating system from any operating system. This is a wonderful thing!

Linux and Windows professionals are usually a little bit at odds with the others platform. Most IT professionals prefer one platform over the other, which is not a bad thing, but just a fact. Linux professionals scoff at having to login to Windows computers, and Windows professionals frequently have to search Google on how to exit vim in Linux.

In recent years, Microsoft has made countless, purposeful decisions to better integration Windows with Linux. Windows 10 now has a Linux Subsystem that can be installed within Windows allowing users to run Linux on Windows, Azure has a massive amount of their workloads running Linux, PowerShell is now open-sourced and available on Linux.

Another example of Microsoft’s effort is the project of delivering OpenSSH on Windows. OpenSSH of course is the most popular method of running remote code on a Linux machine, and has been around for many years. Now that it is close to being production-ready in Windows, this means it can be used on practically any platform.

OpenSSH on Windows Makes Life Easier for IT Pros

Being that my expertise is in Windows, when I want to remote into a Linux server, I normally use something like Putty. Putty is a Windows utility that allows you to SSH into Linux. Don’t get me wrong, Putty works great, but it means having a separate application for using Linux from Windows and it not native to the OS. Not fun. I spend the majority of my time in a PowerShell prompt, I don’t want to use a different application.

With OpenSSH on Windows, I can actually SSH right into a Linux machine (or Windows) right from PowerShell (or CMD). This means I just need one command prompt to do all my work on whatever platform I need to work on. This makes my job simpler. Simple is good. Simple in IT is ALWAYS better.

Even more, using OpenSSH on Windows allows you to perform PowerShell Core remoting commands like Enter-PSSession into Linux, for those who want to continue using PowerShell remoting commands.


Installing Built-in OpenSSH on Windows 10

At this time there are two ways to use OpenSSH on Windows. The first is via Windows 10 Fall Creators Update, which has the OpenSSH beta built-in as a capability. To install, open PowerShell and run:

PS C:\ > Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH*'}


Name  : OpenSSH.Client~~~~

State : NotPresent


Name  : OpenSSH.Server~~~~

State : NotPresent

Now that I know the capability is available, I can now install:

PS C:\> Add-WindowsCapability -Online -Name OpenSSH.Client~~~~

PS C:\> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~

Installing OpenSSH with the Universal Installer:

Darwin Sanoy has been a great Chocolatey community member for years. He manages many community packages, one of these being the OpenSSH package. He even designed this package as a Universal Installer that allows you to install OpenSSH with or without Chocolatey. To install it with Chocolatey, we can run:

PS C:\> choco install openssh -y -params '"/SSHAgentFeature"'

This will install OpenSSH agent on my local machine. Keep in mind there are two main components of OpenSSH, the agent and server. The agent allows you to remote to other servers, and the server feature allows other machines to remote into yours.

Related: Chocolatey Is Quite Yummy

So to install OpenSSH with the server features we can use:

PS C:\> choco install openssh -y -params '"/SSHServerFeature"'

Connecting to Linux via SSH from PowerShell

Now that I have SSH installed, let’s run it from PowerShell and connect to a Linux server (linux-test):

PS C:\> ssh root@linux-test

root@linux-test password:

Last login: Wed Mar 21 13:55:04 2018 from windows-test

[root@ linux-test ~]# uname


[root@linux-test ~]#

Related Posts

Comments are disabled in preview mode.
Loading animation