Windows 安装 OpenSSH 服务端
Windows 10 开启
在系统设置的 应用
中的 管理可选功能
安装 OenSSH 客户端 和 OpenSSH 服务器
Github 下载
https://github.com/PowerShell/Win32-OpenSSH/releases
安装
解压 OpenSSH,添加 Path 环境变量 D:\Program Files\OpenSSH
,以管理员身份运行 PowerShell
1 | cd D:\Program Files\OpenSSH |
设置服务自动启动并启动服务
1
2sc config sshd start= auto
net start sshd配置服务
1 | # 取消注释 |
- 执行 PowerShell 命令
1 | cd C:\Progra~1\OpenSSH |
- 重启 SSHD 服务
1 | net stop sshd |
开启端口
打开 控制面板 -> Windows 防火墙 -> 高级设置 -> 入站规则 -> 新建规则 -> 端口 -> TCP,特定端口 22
-> 允许连接 -> 下一步
将 PowerShell 设为默认 Shell
1 | New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force |