locked
OPENSSH on W2K16 CORE. RRS feed

  • Question

  • Hello!

      Is it possible to install OPENSSH support on a W2K16 CORE?

    Thanks in advance.


    Doria

    Tuesday, June 9, 2020 1:37 PM

Answers

All replies

  • Hi Doria,

    Yes this should be possible.

    Installing and Configuring OpenSSH on Windows Server 2019
    https://techcommunity.microsoft.com/t5/itops-talk-blog/installing-and-configuring-openssh-on-windows-server-2019/ba-p/309540

    (Same applies to Windows Server 2016)

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by dydoria Wednesday, June 10, 2020 8:23 PM
    Tuesday, June 9, 2020 2:33 PM
  • Try the following method:
    https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

    Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
    Add-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, June 10, 2020 2:49 PM
  • Sorry, I decided to redo the post.

    PS C:\temp> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    
    Path          :
    Online        : True
    RestartNeeded : False
    
    PS C:\temp> Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    
    Path          :
    Online        : True
    RestartNeeded : False
    
    PS C:\temp> Set-Service -Name ssh-agent -StartupType ‘Automatic’
    Set-Service : Service ssh-agent was not found on computer '.'.
    At line:1 char:1
    + Set-Service -Name ssh-agent -StartupType ‘Automatic’
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (.:String) [Set-Service], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.SetServiceCommand
    
    PS C:\temp> Set-Service -Name sshd -StartupType ‘Automatic’
    Set-Service : Service sshd was not found on computer '.'.
    At line:1 char:1
    + Set-Service -Name sshd -StartupType ‘Automatic’
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (.:String) [Set-Service], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.SetServiceCommand
    
    PS C:\temp>
    

      1. Was the service installed but not found? Am I forgetting some part?

    PS C:\temp> Install-Module -Force OpenSSHUtils -Scope AllUsers
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name
    'OpenSSHUtils'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:9709 char:34
    + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
       ception
        + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
    
    PS C:\temp> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
    PS C:\temp>

      2. In which repository will I find the OpenSSHUtils module to install? Follow what is registered.

    PS C:\temp> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    PSGallery                 Trusted              https://www.powershellgallery.com/api/v2

    Thanks.


    Doria

    Wednesday, June 10, 2020 3:29 PM
  • OpenSSH Server is part of Features-On-Demand (FOD), it is not preinstalled in the Windows so this is why the Get-WindowsCapability is not retrieving the OpenSSH Server feature.

    You'll need to get the Features on Demand (FOD) .ISO files and copy the .cab for OpenSSH Server from there.

    https://secureinfra.blog/2019/11/22/offline-installation-of-openssh-server-on-windows-server-2019/


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by dydoria Wednesday, June 10, 2020 8:01 PM
    Wednesday, June 10, 2020 4:01 PM
  • Wonderful!

      That´s solve the service installation issue.

      Any change to install OpenSSHUtils from FOD too?

    Thanks for your help.


    Doria


    • Edited by dydoria Wednesday, June 10, 2020 8:17 PM
    Wednesday, June 10, 2020 8:17 PM
  • You should be able to get the OpenSSHUtils from Internet, it requires the NuGet provider, but if your Server 2016  Core is connected to the Internet, you should be able to install it with the following command:

    Install-Module -Force OpenSSHUtils -Scope AllUsers


    Blog: https://thesystemcenterblog.com LinkedIn:

    Wednesday, June 10, 2020 8:22 PM
  • Thanks for your answer, but as I posted above, the command returns an error stating that the module does not exist in the repository and suggesting the search in some other. Is there any other repository that I can use?

    PS C:\temp> Install-Module -Force OpenSSHUtils -Scope AllUsers
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name
    'OpenSSHUtils'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:9709 char:34
    + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
       ception
        + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
    
    PS C:\temp>
    PS C:\temp> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
    PS C:\temp>
    PS C:\temp>
    PS C:\temp>
    PS C:\temp> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    PSGallery                 Trusted              https://www.powershellgallery.com/api/v2
    
    


    Doria

    Thursday, June 11, 2020 2:39 PM
  • Saturday, June 13, 2020 2:04 PM
  • Thanks for your answer.

      Weird! When I try to install by specifying the exact version, the error changes. Is there any workaround for the signature error below?

    PS C:\temp> Install-Module -Name OpenSSHUtils -RequiredVersion 1.0.0.1
    PackageManagement\Install-Package : The module 'OpenSSHUtils' cannot be installed or updated because the authenticode signature of
    the file 'OpenSSHUtils.psd1' is not valid.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:9709 char:34
    + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
        + FullyQualifiedErrorId : InvalidAuthenticodeSignature,ValidateAndGet-AuthenticodeSignature,Microsoft.PowerShell.PackageManageme
       nt.Cmdlets.InstallPackage
    
    


    Doria

    Sunday, June 14, 2020 1:39 AM
  • I don't see why it's complaining about not being valid, I'd try downloading the files manually instead.

    Blog: https://thesystemcenterblog.com LinkedIn:

    Sunday, June 14, 2020 8:00 AM
  • Am I forgetting something?

    PS C:\temp> Import-Module C:\temp\opensshutils.1.0.0.1\OpenSSHUtils.psd1
    PS C:\temp> Get-Command -Module OpenSSHUtils
    
    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Function        Enable-Privilege                                   1.0.0.1    OpenSSHUtils
    Function        Get-UserAccount                                    1.0.0.1    OpenSSHUtils
    Function        Get-UserSID                                        1.0.0.1    OpenSSHUtils
    Function        Repair-AuthorizedKeyPermission                     1.0.0.1    OpenSSHUtils
    Function        Repair-FilePermission                              1.0.0.1    OpenSSHUtils
    Function        Repair-SshdConfigPermission                        1.0.0.1    OpenSSHUtils
    Function        Repair-SshdHostKeyPermission                       1.0.0.1    OpenSSHUtils
    Function        Repair-UserKeyPermission                           1.0.0.1    OpenSSHUtils
    Function        Repair-UserSshConfigPermission                     1.0.0.1    OpenSSHUtils
    
    PS C:\temp> Register-PSRepository -Name 'localrepo' -SourceLocation 'C:\temp\opensshutils.1.0.0.1' -InstallationPolicy Trusted
    PS C:\temp> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    PSGallery                 Trusted              https://www.powershellgallery.com/api/v2
    localrepo                 Trusted              C:\temp\opensshutils.1.0.0.1
    
    PS C:\temp> Install-Module -Force OpenSSHUtils -Scope AllUsers -RequiredVersion 1.0.0.1 -Repository 'localrepo'
    PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'OpenSSHUtils'. Try
    Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4\PSModule.psm1:9709 char:34
    + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
        + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
    


    Doria

    Monday, June 15, 2020 12:16 AM
  • You might want to ask the subject matter experts of PowerShell in the dedicated forum over here:
    https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell

    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, June 15, 2020 7:28 AM
  • Thanks all!


    Doria

    Monday, June 15, 2020 11:47 AM