Windows10 SSH 服务器安装没有创建所需的服务

Windows 10 SSH server installation does not create required services

我正在尝试在我的 Windows 10 台电脑上安装 Open-SSH,以便使用 ssh 从我的 linux 机器连接到它。我正在关注 this tutorial,但一旦我必须 运行 类似 Start-Service ssh-agent 的内容,它就会说该服务不存在。另一件不起作用的是 Install-Module -Force OpenSSHUtils,它说 the signature of the file 'OpenSSHUtils.psd1' is not valid. 我已经尝试了许多其他教程,在每个教程之前都卸载了所有内容,其中 none 正在运行。有没有办法手动安装这些东西?我是否遗漏了重要的安装步骤?

您知道可以使用添加功能选项直接在 Windows10 中安装 SSH,对吗?无需下载外部 module/tool 除非内置的无法满足您的所有需求。

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

使用 GUI

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

但是,如果您决定使用外部的东西,那么,在真正实施之前始终测试破坏性(CUD = 创建、更新、删除)代码。

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'".
#>