本文是绿色版OpenSSH安装教程,如果嫌麻烦可以用安装版
微软官方提供了Windows下OpenSSH的支持以及各种安装方法,以及Github中的,另外也有第三方提供的版本.,本文使用github中的版本进行手动安装,点击此处下载.
netstat -anop TCP
.\ssh-keygen.exe -A
Powershell.exe -ExecutionPolicy Bypass -Command ". .\FixHostFilePermissions.ps1 -Confirm:$false"
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow
Set-Service sshd -StartupType Automatic
Set-Service ssh-agent -StartupType Automatic
net start sshd
ssh username@host
,回车键入密码,看是否登陆成功,sshd监听的端口默认是22,如果是自定义端口,则要用 ssh -p2222 uasename@host
2222为自定义端口.至此已经安装完毕,如果要卸载,请执行以下命令: powershell.exe -ExecutionPolicy Bypass -File uninstall-sshd.ps1