The Future of Remoting in Windows - OpenSSH

The Future of Remoting in Windows - OpenSSH

Posted on September 12, 2018 0 Comments

With OpenSSH, 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, 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 opensource 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.

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!

Learn how to automate IT tasks with PowerShell. Download this eBook. 

Why it 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~~~~0.0.1.0

State : NotPresent

 

Name  : OpenSSH.Server~~~~0.0.1.0

State : NotPresent

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

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

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

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.

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

Linux

[root@linux-test ~]#

Dan Franciscus

Dan Franciscus is a systems engineer and VMware Certified Professional (VCP) specializing in VMware, PowerShell, and other Microsoft-based technologies. You can reach Dan at his blog (http://www.winsysblog.com/) or Twitter at @dan_franciscus.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation