-
OpenSSH-Win64.zip下载
资源介绍
下载OpenSSH-Win64.zip https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v8.1.0.0p1-Beta
解压到C:\OpenSSH
#安装
cd C:\OpenSSH
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
#开通防火墙
#Windows 2012+
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
#Windows 2008
netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22
#启动
net start sshd
#设置服务自动启动
Set-Service sshd -StartupType Automatic
#强烈建议:将SSH连接的shell设置为powershell,否则默认是cmd
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "/c" -PropertyType String -Force
#推荐建议:将powershell升级到4.0
参考:Windows2008升级PowerShell到4.0