使用 PowerShell 安装 OpenSSH
使用 PowerShell 安装 OpenSSH

使用 PowerShell 安装 OpenSSH

若要使用 PowerShell 安装 OpenSSH,请先以管理员身份运行 PowerShell。

Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

如果两者均尚未安装,则此操作应返回以下输出:

Name : OpenSSH.Client~~~~0.0.1.0
State : NotPresent

Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent

然后,根据需要安装服务器或客户端组件:

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

这两者应该都会返回以下输出:

Path :
Online : True
RestartNeeded : False

连接到 OpenSSH 服务器

ssh username@servername

连接后,会收到如下所示的消息:

The authenticity of host 'servername (10.00.00.001)' can't be established.
ECDSA key fingerprint is SHA256:().
Are you sure you want to continue connecting (yes/no)?

选择“是”后,该服务器会添加到包含 Windows 客户端上的已知 SSH 主机的列表中。

系统此时会提示你输入密码。 作为安全预防措施,密码在键入的过程中不会显示。

连接后,你将看到 Windows 命令行界面提示符:

domain\username@SERVERNAME C:\Users\username>

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

Title - Artist
0:00