Fastest Way To Get Your Hands on the New Win32-OpenSSH

Fastest Way To Get Your Hands on the New Win32-OpenSSH

If you’re like me, you grow tired of having to install a seperate terminal utility on Windows to use ssh to connect to the vast array of devices and services that use it as a primary communications mechanism. Why can’t it just be done from the command line like every other OS? That’s changing…

The PowerShell Team at Microsoft is making a native OpenSSH client for Windows a reality! It is an open source project and they seem to be serious about taking it all the way. Don’t mistake this for a Microsoft product announcement of a fully baked, OS integrated, windows updates patched optional Windows feature. It is truly an open source project that is going through the normal cycle of finding and fixing bugs in early releases.

The PowerShell team is porting the original C code and generating win32 binaries. This has some great advantages such as servicing older versions of Windows, being available in any native or additional command line environment and not requiring .NET to be installed. So it should be easy to deploy to minimal environments like the new Nano Server.

The releases contain the main ssh client and sshd server components including: ssh.exe, ssh-add.exe, ssh-agent.exe, ssh-keygen.exe, ssh-keyscan.exe, ssh-keysign.exe, ssh-pkcs11-helper.exe, scp.exe, sftp.exe, sshd.exe (server), sftp-server.exe.

The installation instructions are not difficult to follow, but they are very manual at this point - this is especially more challenging for getting the server installed. A problem ripe for Chocolatey - the new kid on the block for automation of software deployment.

I took a little time to put together a chocolatey package so that if you are curious to give it a spin and give feedback on the prereleases, it won’t take you very long to get it setup.

If you are one of the lone few that aren’t already using chocolatey you can install the chocolatey client with the instructions on the Chocolatey.org homepage and then run the command “choco install win32-openssh” or for PowerShell 5 PackageManagement use “install-package win32-openssh -provider chocolatey”.

If you’re even less patient than that, you can review the code and then run the following PowerShell oneliner from the web as an elevated admin - it will install chocolatey and then Win32-OpenSSH in one go.

Review the code like a good admin here: Chocolatey OpenSSH Install

Then run this oneliner (may be some spaces if copied from the web):

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {[bool]1};set-executionpolicy RemoteSigned -Force -EA 'SilentlyContinue';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/DarwinJS/ ChocoPackages/master/win32-openssh/InstallChoco_and_win32-openssh.ps1'))

By default the script will install all the binaries, but not configure the server service. To do that you must use special switches which are documented in the package page on Chocolatey here: https://chocolatey.org/packages/win32-openssh

I am working on a new course about Chocolatey NuGet goodness - if you’d like to be notified - just click the “Follow” link at the top of this article!

Happy SHHelling!