SSH on Windows Server 2019

___________________________________________________________________________________________________________________________

IMPORTANT ANNOUNCEMENT FOR OUR READERS!

AskPFEPlat is in the process of a transformation to the new Core Infrastructure and Security TechCommunity, and will be moving by the end of March 2019 to our new home at https://aka.ms/CISTechComm (hosted at https://techcommunity.microsoft.com). Please bear with us while we are still under construction!

We will continue bringing you the same great content, from the same great contributors, on our new platform. Until then, you can access our new content on either https://aka.ms/askpfeplat as you do today, or at our new site https://aka.ms/CISTechComm. Please feel free to update your bookmarks accordingly!

Why are we doing this? Simple really; we are looking to expand our team internally in order to provide you even more great content, as well as take on a more proactive role in the future with our readers (more to come on that later)! Since our team encompasses many more roles than Premier Field Engineers these days, we felt it was also time we reflected that initial expansion.

If you have never visited the TechCommunity site, it can be found at https://techcommunity.microsoft.com. On the TechCommunity site, you will find numerous technical communities across many topics, which include discussion areas, along with blog content.

NOTE: In addition to the AskPFEPlat-to-Core Infrastructure and Security transformation, Premier Field Engineers from all technology areas will be working together to expand the TechCommunity site even further, joining together in the technology agnostic Premier Field Engineering TechCommunity (along with Core Infrastructure and Security), which can be found at https://aka.ms/PFETechComm!

As always, thank you for continuing to read the Core Infrastructure and Security (AskPFEPlat) blog, and we look forward to providing you more great content well into the future!

__________________________________________________________________________________________________________________________

Hello all from PFE Land! I’m Allen Sudbring, PFE in the Central Region. Today I’m going to talk about the built in SSH server that can be added to Windows Server 2019. With previous versions of server, there was some detailed configuration and installs you needed to do, to get SSH working on a Windows Server. With Windows Server 2019, it has become much easier. Here are the steps to install, configure, and test:

  1. Open a PowerShell window on the Server you wish to install at:

  2. Run the following command to install the SSH server components:

    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

  3. The install opens the firewall port and configures the service. Last step is start both SSH services with the following command and set them to automatic:

    Set-Service sshd -StartupType Automatic

    Set-Service ssh-agent -StartupType Automatic

    Start-Service sshd

    Start-Service ssh-agent

  4. Test with SSH client. I used Ubuntu installed on Windows 10 WSL. The format for server on domain to connect is upn of the login account @servername, as in:

ssh allenadmin@sudbringlab.com@servername

  • For servers in a workgroup, use a local admin account@servername as in:

ssh AzureVMAdmin@servername

5. After you login, you receive a command prompt where you can proceed with CMD or open PowerShell:

       

OpenSSH gives you the ability to connect to your windows servers without remote PowerShell and get a full CMD and PowerShell Experience. The ability to connect to Windows machines from Linux with a remote CMD shell is also useful in mixed environments.

In case you’re asking, you also can do the opposite way, and install PowerShell on Linux and remote to a PowerShell Instance on a Linux Machine with PowerShell Core on a Window Machine, but that is for a later post…

Thanks for reading!