Installing an OpenSSH server/client on a Windows 2016 server arms the user with a multi-function set of client/server utilities that facilitate a secure environment when logging into or transferring files to your windows server remotely. It also serves as a security management tool for your public/private key pairs. To install OpenSSH, use the following procedure:
Note: To make the following changes, you must be logged in as SYSTEM or Administrator. If you are installing OpenSSH with Powershell, make sure to launch Powershell as an Administrator.
- From https://github.com/PowerShell/Win32-OpenSSH/releases, download the latest .zip of OpenSSH. The typical choice for Windows 2016 is to download the [OpenSSH-Win64.zip] option.
- Extract the OpenSSH-Win64.zip file and save it on your console. The easiest way to find it locally would be to save it in your [C:\Program Files\].
- Open your console’s Control Panel. In the System and Security section, open up System. Click on Advanced System Settings and, in the System Properties dialog box, click Environmental Variables.
- In the System Variables section on the bottom half of the dialog, select Path. Click Edit….
- Click New. Add the OpenSSH folder path. After you have added the folder, you may now close the System Properties> dialog.
- >Run Powershell as an Administrator. Enter the OpenSSH folder path in the appropriate field. To install OpenSSH, run the
'.\install-sshd.ps1'command. If the line
“sshd and ssh-agent services successfully installed”appears, installation was successful.
- To generate a host key, run the '.\ssh-keygen.exe -A' command.
- Reopen your Control Panel and click on Administrative Service/Administrative Tools. In the resulting dialog, click Services. Find ‘sshd’ in the list and change the startup type to Automatic. Then, run sshd.
Altering Windows Firewall Settings to Allow SSH Connection
If Windows firewall is running, you may have trouble connecting SSHD to your Windows server. Use the following procedure to change Windows firewall settings to ensure the SSH can connect properly:
- In your Control Panel, click System Security and then click on Windows Firewall. Click on Advanced Settings in the panel on the left side of the dialog box.
- In the Windows Firewall With Advanced Security dialog, select Inbound Rules from the menu to the left. Select New Rule from the menu on the right.
- This will open the New Inbound Rule Wizard dialog. When the New Inbound Rule Wizard dialog opens, select Protocol and Ports from the menu on the left of the dialog. Select the Custom option and click Next.
- In the Program section, select All Programs.
- Finally, in the Protocols and Ports section, select TCP and enter ‘22’ in the Specific local ports box. Finish and exit the New Inbound Rule Wizard
You have now successfully ensured that your SSH setup can connect to the Windows server.
Special Note: Windows hosting has a reputation for being costly, but that doesn't have to be the case. Visit our Best Windows hosting reviews page to find the best deals from the top windows hosting providers.