当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

作者:精品下载站 日期:2024-12-14 12:25:32 浏览:13 分类:玩电脑

在 Windows Server 2019 上配置 OpenSSH 服务器


如果您来自 Linux 世界,并且由于某种原因,您目前发现自己处于 Windows 2019 服务器遍布您周围的情况,那么对您来说有个好消息。我们知道您习惯于使用 SSH 登录和管理您的服务器,而现在您处于完全不同的环境中。虽然有用于登录远程 Windows 服务器的 Powershell 选项,但大多数具有 Linux 背景的管理员可能会发现很难适应。

Windows Server 2019 和最新版本的 Windows 10 具有安装 SSH 客户端和 SSH 服务器的功能。现在可以只使用您最喜欢的 ssh 客户端,而不是 RDP 或适用于 Linux 的 Windows 子系统。这是一个非常棒的消息。

让我们不要浪费更多时间,继续安装 OpenSSH Server。确保您的 Windows Server 可以访问 OpenSSH Server 部分的互联网。

第 1 步:打开设置

单击“开始”按钮并选择“设置”。应该是齿轮图标。

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

第 2 步:应用程序

启动设置后,选择“应用”,然后单击“管理可选功能

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

第3步:选择OpenSSH服务器

您应该在“添加功能”下看到“OpenSSH Server”。单击它,然后单击“安装

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

第4步:启动服务器并更改启动策略

单击“Windows”按钮打开“服务”应用程序并搜索“服务”。打开后,查找OpenSSH Server,右键单击并选择属性。将打开一个新的弹出窗口。在其中,从下拉列表中将启动更改为自动,如下图所示,然后启动服务器。

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

右键单击 OpenSSH Server 并选择属性

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

将启动更改为自动,“启动”服务器并单击“确定

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

步骤 5:在防火墙中允许端口 22

如果服务器中的防火墙已打开,请允许 TCP 端口 22,以便客户端能够连接到服务器。按照如何在 Windows Server 防火墙指南中打开端口,仅将端口更改为 22。

步骤 6:在 Windows 上安装 SSH 客户端

使用 PowerShell 安装

您还可以通过在 Powershell 中运行以下命令来安装 OpenSSH 服务器和客户端。使用管理员权限打开 Powershell 并运行命令。

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

在 PowerShell 中运行的命令

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

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

## Change server start-up to Automatic 
Set-Service -Name sshd -StartupType ‘Automatic’ 

## Start the Server and change start-up to Automatic
Start-Service sshd

第 8 步:测试 OpenSSH 服务器

使用 SSH 客户端连接到 SSH 服务器,如下所示。如您所见,我们位于 IP 为 10.10.20.2 的服务器上,并且通过“sshing”连接到 10.10.20.21。输入“yes”并输入帐户密码。

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

而我们在..

[玩转系统] 在 Windows Server 2019 上配置 OpenSSH 服务器

结论

我们已成功安装和配置 OpenSSH 服务器和客户端。感谢您的阅读。

另请阅读:

  • 如何在 Windows Server 2019 上配置 iSCSI 启动器
  • 如何在 Windows Server 2019 上配置 iSCSI 启动器
  • 在 Windows Server 2019 上安装和配置 IIS Web 服务器
  • 如何在 Windows IIS Server 2019 上配置虚拟目录
  • 在 Windows Server 2019 上安装和配置 NFS 服务器
  • 如何在 Windows Server 2019 中安装 Active Directory 域服务
  • 如何在 Windows Server 防火墙中打开端口

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯