win10安装配置ssh服务

编程知识 更新时间:2023-05-02 20:23:33

文章目录

    • 1. 在线安装
      • 1.1 使用Windows 设置安装
      • 1.2 powerShell 安装
    • 2. 离线安装
      • 2.1 下载离线安装
      • 2.2 解压后到解压目录下 进入cmd 执行
      • 3.3 设置开启启动,启动服务
      • 3. ssh 登录服务

1. 在线安装

		详情参考:https://learn.microsoft/zh-cn/windows-server/administration/openssh/openssh_install_firstuse

1.1 使用Windows 设置安装

	(1) 打开设置  选择应用


(2)可选功能

(3)添加功能 > openssh > 安装

1.2 powerShell 安装

1. 以管理员身份运行 PowerShell,输入以下命令
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'
如果两者均未安装,则次返回以下输出


2. 根据需要安装服务器或客户端组件

# 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
3. 启动并配置OpenSSH 服务 使用ssh service 命令 启动服务
# Start the sshd service
Start-Service sshd

# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

# Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify
if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
    Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."
    New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
    Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."
}

2. 离线安装

2.1 下载离线安装

https://github/PowerShell/Win32-OpenSSH/releases

2.2 解压后到解压目录下 进入cmd 执行

powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
成功后如下图

3.3 设置开启启动,启动服务

sc config sshd start= auto
net start sshd

3. ssh 登录服务

	使用   ssh 用户名@远程主机ip   命令登录
	输入密码即可

更多推荐

win10安装配置ssh服务

本文发布于:2023-04-28 12:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/2bfa1d78d6c0636e1e969aa2c7d9f0ed.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ssh

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 108698文章数
  • 27504阅读数
  • 0评论数