This week, The Windows Insider team announced that OpenSSH has arrived to Windows Server 2016 1709 and Windows 10 1709.
In this article, I’ll show you how to Install the new OpenSSH Server and Client and how I configure OpenSSH Server on my Windows Server 2017 1709.
I’ll also show you how to use WinSCP and copy files from my Windows Server 2016 1709 Server using SSH.
I have to say that before doing this article and researching the topic, I saw 10 blogs and non-of them showed how to configure it properly and all articles were wrong.
On this blog, I always make sure that everything that I post works 100% and I’ve tried on real Servers, So you can be sure that If you follow this post thing will work.
To get this thing working, I’m using Windows Server 2016 1709 on Microsoft Azure.
In my case, I’ll install both Server and client on 1703 a connect to it using WinSCP and SSH from another Windows Server 2016.
In the line below, I’ll first check that that OpenSSH Is not Installed on my Window Server 2016 1709 Server.
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
As you can OpenSSH Is not Installed and I’ll go ahead and Install it.
To Install the OpenSSH Client, I’ll use the cmdlet below which, If you don’t Install the Server part just restart the Server when done.
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Install SSH Server
This is the more important part of this post, and using the line below I’m installing the OpenSSH Server which will allow me to connect to my Windows Server using SSH and copy file using WinSCP.
To Install the OpenSSH Server I’m running the line below.
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
If you are just Installing the client, just restart the Server and you’re ready to connect to other host using SSH with the line below.
Once Installed, the two Services below will be Installed on my Server
- OpenSSH Client – SSH-Agent
- OpenSSH Server – sshd
Below, You will see the two Installed Services.
Note – In order for the Server Service to work, I’ll need to configure it first.
Configure SSH Server
To configure the SSH Server to accept connection, I’ll run the cmdlets below that will create a security key and will allow connections.
cd C:\Windows\System32\OpenSSH .\ssh-keygen -A .\ssh-add ssh_host_ed25519_key Install-Module -Force OpenSSHUtils
Next, I’ll run the cmdlet below
Install-Module -Force OpenSSHUtils
Repair-SshdHostKeyPermission -FilePath C:\Windows\System32\OpenSSH\ssh_host_ed25519_key
The last part Is to open the Firewall port and allow SSH connections.
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -Profile Domain
Now that my SSH Server Is up and running I test it by connecting to it from another server using PuTTY
Now, I’ll be asked to supply a username and password.
To use WinSCP to copy a file to and from my Windows Server 2016 1709, I’ll download the WinSCP client from the Internet and use it to connect.
All I need to do Is select a file from and copy
As you can see the file was copied successfully