install-sshd.ps1。 因为此系统禁止运行脚本修改策略。
get-executionpolicyrestrictedset-executionpolicyremotesigned按如下方式重新运行脚本:
.install-sshd.PS1 [ * ] c :program files (x86 (OpenSSH-win64 ) ) programfiles(x86 ) OpenSSH-win64 )模块' . '应用程序分配包' nowhasreadaccessto ' c : (program ) onpacces所有受限APP应用程序包“nowhasreadaccessto'c: 程序文件(x86 )打开-打开643模块'.repaired permissions [ sc ]设置服务对象安全成功[ sc ]更改服务配置
退出Powershell,以管理员权限运行cmd并启动相应的sshd服务
cquerysshdservice _ name : sshd type :10 win32 _ own _ process state 33601 stopped win32 _ exit _ code 33601077 (0x 4355 seressserinstation )0x0wait _ hint :0 x0 scstartsshdservice _ name : sshd type :10 win32 _ own _ process state 3360 start _ name 3362、not, ignores _ shut down (win32 _ exit _ code : (0x0) service_exit_code: )0x0)中的check point 33600 x0 wait _ hint ame 3360 sshd type 336010 win32 _ own _ pr vice start _ pending (not _ stoppable,NOT_PAUSABLE, ignores _ shut down (win32 _ exit _ code : (0x0) service_exit_code: )0x0)中的check point 33600 x0 wait _ hint 如果未指定配置文件生成路径,则默认生成路径为%programdata%ssh,
在成功启动服务后,访问端口将在ssh的默认端口22上测试当前系统上的访问,以允许当前系统上的登录帐户默认远程访问,然后打开cmd并执行远程连接命令。
sh-p22 [ username ] @ ([ host ] theauthenticityofhost ' [ host ] :22 ([ host ] :22 (22 ) ) ) )。) can ' tbe established.ecdsakeyfingerprintissha 2563360 bneefjf1eawtdrvw4iu/19u0xxuolwrb 20 u/d 64k7WC.areyousureyouwantto ys warning : permanently added ' [ host ] :22 ' [ ECD sa ] tothelistofknownhosts.[ username ' spassword336666保留所有权的用户名称为当前登录用户,主机为当前主机LANIP,-p port默认为22个端口,则不需要添加
ecdsakeyfingerprintissha 256: bneefjf1eawtdrvw 4iu/19u0xxuolwrb 20 u/d 64k 7wc是[username]/.ssh/known_hosts文件中的证书以上是笔者记录的OpenSSH在Windows上的安装作业流程。
三.参考链接[1] OpenSSH For Windows官方文档:
3359 github.com/powershell/win32-OpenSSH/wiki/sshd _ config
[2]微软官方文档:
3359 docs.Microsoft.com/zh-cn/windows-server/administration/OpenSSH/OpenSSH _ server _ configuration