I don’t know if anyone else has noticed, Windows 10 has OpenSSH builtin. sshd.exe found in C:\Windows\System32\OpenSSH. It means now you can connect to windows using ssh.
不知道有没有人留意过, Windows 10 开始内置了 OpenSSH, 其中就有 sshd.exe. 也就是说, Windows 内置的 OpenSSH 拥有启动 SSHD 的功能.
After searching Services. I found OpenSSH Server in services. It is disabled by default.
在翻看服务列表后, 果然找到了 OpenSSH Server, 默认是需要手动启动的.
Start the service, type ssh karlatemp@::1, type my password. Done!
A file named install-sshd.ps1 exists in the lastest release of Microsoft’s OpenSSH. Just type powershell C:\Windows\System32\install-sshd.ps1 in cmd (Administrator).
在下载的 zip 中有一个叫 install-sshd.ps1 的文件, 只需要执行上面这行命令就能安装 sshd (管理员模式)
Troubleshooting
After .ssh/authorized_keys configed, type ssh karlatemp@::1, not working!!
debug2: parse_server_config_depth: config reprocess config len 2200 debug3: checking match for 'Group administrators' user karlatemp host 127.0.0.1 addr 127.0.0.1 laddr 127.0.0.1 lport 22 debug3: get_user_token - i am running as karlatemp, returning process token debug1: user karlatemp matched group list administrators at line 87 debug3: match found debug3: reprocess config:88 setting AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys .......................................................... debug2: input_userauth_request: try method publickey [preauth] debug2: userauth_pubkey: valid user Karlatemp querying public key rsa-sha2-512 AAAAB3u........ [preauth] .......................................... debug3: mm_answer_keyallowed: entering debug1: trying public key file __PROGRAMDATA__/ssh/administrators_authorized_keys debug3: Failed to open file:C:/ProgramData/ssh/administrators_authorized_keys error:2 debug1: Could not open authorized keys '__PROGRAMDATA__/ssh/administrators_authorized_keys': No such file or directory debug3: mm_answer_keyallowed: publickey authentication test: RSA key is not allowed Failed publickey for Karlatemp from 127.0.0.1 port 9431 ssh2: RSA SHA256:VCTkssQTyBJKQ6sg2BwIJYYnTYt3osJrHprxnGsJfB8 ........................................... debug2: input_userauth_request: try method publickey [preauth] debug2: userauth_pubkey: valid user Karlatemp querying public key ecdsa-sha2-nistp521 AAAAE2VjZHN....... [preauth] debug1: userauth_pubkey: publickey test pkalg ecdsa-sha2-nistp521 pkblob ECDSA SHA256:zPVO........ [preauth] debug3: mm_key_allowed: entering [preauth] .................................. debug1: trying public key file __PROGRAMDATA__/ssh/administrators_authorized_keys debug3: Failed to open file:C:/ProgramData/ssh/administrators_authorized_keys error:2 debug1: Could not open authorized keys '__PROGRAMDATA__/ssh/administrators_authorized_keys': No such file or directory debug3: mm_answer_keyallowed: publickey authentication test: ECDSA key is not allowed Failed publickey for Karlatemp from 127.0.0.1 port 9431 ssh2: ECDSA SHA256:zPVOOjAvI0/F2dsFT346uFev5cOpKSlEsPFt5ZiSezU ..................................... debug1: attempt 4 failures 3 [preauth] debug2: input_userauth_request: try method password [preauth]
View sshd_config again, found in last
再认真看一次 sshd_config, 在末尾找到了
1 2
Match Group administrators AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
After disabling it and restarting the OpenSSH Server service. Success to login~~