安装OpenSSH for Windows
下面是在powershell中操作的命令记录
choco install powershell-core -y
choco install openssh
cd C:\Program Files\OpenSSH-Win64
Set-ExecutionPolicy RemoteSigned
#设置默认shell为powershell
.\Set-SSHDefaultShell.ps1 -PathSpecsToProbeForShellEXEString "\$env\:userprofile\downloads\*.exe;c:\Program Files\PowerShell\*\P\*.exe;c:\windows\system32\*"
#配置认证用authorized_keys
#系统管理员需要把authorized_keys保存到C:\ProgramData\ssh\下面,并命名为administrators_authorized_keys
#配置authorized_keys权限
icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""*S-1-5-32-544:F"" /grant ""SYSTEM:F""
# 大工完成