Search code examples
powershellwindows-10openssh

Windows 10 SSH server installation does not create required services


I am trying to install Open-SSH on my Windows 10 pc in order to connect to it from my linux machine with ssh. I am following this tutorial, but as soon as I have to run something like Start-Service ssh-agent, it says that the service doesn't exist. Another thing that doesn't work is Install-Module -Force OpenSSHUtils, and it says that the signature of the file 'OpenSSHUtils.psd1' is not valid. I have tried many other tutorials, uninstalling everything before each one, and none of them are working. Is there any way to install these things manually? Am I missing an important step of the installation?


Solution

  • You do know you can install SSH directly in Windows 10 by using Add Feature option, correct? No need to download an external module/tool unless the builtin one does not provide all you are after.

    Installation of OpenSSH For Windows Server 2019 and Windows 10

    # Install the OpenSSH Client
    Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
    
    # Install the OpenSSH Server
    Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    

    Using the GUI

    How to Enable and Use Windows 10’s New Built-in SSH Commands

    Yet, if you do decide to use external stuff, then, Always test destructive (CUD = Create, Update, delete) code before true implementation.

    Find-Module -Name 'OpenSSHUtils' -Verbose
    
    <#
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
    VERBOSE: Using the provider 'PowerShellGet' for searching packages.
    VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
    VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
    VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
    VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
    VERBOSE: Total package yield:'1' for the specified package 'OpenSSHUtils'.
    
    Version              Name                                Repository           Description                                                                                                           
    -------              ----                                ----------           -----------                                                                                                           
    1.0.0.1              OpenSSHUtils                        PSGallery            Configure OpenSSH for Windows related security settings like file owner and permissions. 
    #>
    
    
    Find-Module -Name 'OpenSSHUtils' -Verbose | 
    Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" -Verbose -WhatIf
    <#
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
    VERBOSE: Using the provider 'PowerShellGet' for searching packages.
    VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
    VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
    VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
    VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
    VERBOSE: Total package yield:'1' for the specified package 'OpenSSHUtils'.
    VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'False'; IsRegistered = 'True'.
    VERBOSE: Using the provider 'PowerShellGet' for searching packages.
    VERBOSE: Using the specified source names : 'PSGallery'.
    VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
    VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
    VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
    VERBOSE: Total package yield:'1' for the specified package 'OpenSSHUtils'.
    What if: Performing the operation "Save Package" on target "'OpenSSHUtils' to location 'C:\Users\Daniel\Documents\WindowsPowerShell\Modules'".
    #>
    
    Install-Module -Name 'OpenSSHUtils' -Verbose -WhatIf
    
    <#
    VERBOSE: Using the provider 'PowerShellGet' for searching packages.
    VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
    VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
    VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
    VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='OpenSSHUtils'' for ''.
    VERBOSE: Total package yield:'1' for the specified package 'OpenSSHUtils'.
    What if: Performing the operation "Install-Module" on target "Version '1.0.0.1' of module 'OpenSSHUtils'".
    #>