SIGN IN / UP
    opened image

    SSH is an essential tool for server administration. In order to add functionality to your Windows Server 2016, it is recommended that you use OpenSSH. This article will guide you through the installation and configuration.

     

    1. Download OpenSSH distribution: Go to https://github.com/PowerShell/Win32-OpenSSH/releases This is where all versions of OpenSSH for Windows are stored. Download the version that is current for your system. At the time of this writing, the latest version available is v9.2.2.2.0p1-Beta, available as OpenSSH-Win64.zip.

     

     

    2. Unpacking and installing: You can manually create a directory C:\Program Files\OpenSSH and extract the contents of the downloaded archive into it.

     

     

    Or alternatively, run PowerShell with administrator privileges and run the following commands to install:

     [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    
    $installDir = "C:\Program Files\OpenSSH"
    
    if (-not (Test-Path $installDir)) { mkdir $installDir }
    
    cd $installDir
    
    $downloadLink = "https://github.com/PowerShell/Win32-OpenSSH/releases/download/v9.2.2.0p1-Beta/OpenSSH-Win64.zip" Invoke-WebRequest -Uri $downloadLink -OutFile .\openssh.zip Expand-Archive .\openssh.zip -DestinationPath $installDir
    
    Move-Item "C:\Program Files\OpenSSH\OpenSSH-Win64\*" "C:\Program Files\OpenSSH\" Remove-Item "C:\Program Files\OpenSSH\OpenSSH-Win64" -Force -Recurse Remove-Item .\openssh.zip 

     

    After that, you need to enable the service with the following command:

     setx PATH "$env:path;$installDir\" -m

     

     

    Now let's install the sshd service.

     powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1

     

    3. Configure network access. 

    OpenSSH uses TCP port 22 by default. to allow incoming connections, you must add the following rule to Windows Firewall:

     New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH

     

     

    Additionally, you can do this manually through the GUI using the Windows Firewall with Advanced Security tool.

     

    1. Starting the OpenSSH service.

    To manage Windows services, use services.msc. Open it, find the "OpenSSH SSH Server" service. In the settings of this service, select automatic startup and activate it.

            

     

     

    5. Verification.

    To verify that the service is running correctly and port 22 is listening, perform:

     

     netstat -a | findstr "22"

     

     

    If port 22 is active, it means that your server is now ready to accept SSH connections.

     

    6. Testing the SSH connection:

     

    Now let's try to connect to your server via SSH. Use any SSH client (such as PuTTY or the built-in SSH client in your OS) and try to establish a connection to your server by specifying its IP address and port 22.

          

       7. Additional customization:

    After successful testing, it is recommended that you configure key authentication for increased security. This will also allow you to automatically connect to the server without entering a password.

     

    In conclusion, OpenSSH is a safe and secure way to install an SSH server on your Windows Server 2016. With it, you can securely and conveniently manage your server remotely.