![密码验证有效,但连接到安装在 Windows Server 2019 上的 OpenSSH 服务器时公钥验证失败](https://linux22.com/image/783172/%E5%AF%86%E7%A0%81%E9%AA%8C%E8%AF%81%E6%9C%89%E6%95%88%EF%BC%8C%E4%BD%86%E8%BF%9E%E6%8E%A5%E5%88%B0%E5%AE%89%E8%A3%85%E5%9C%A8%20Windows%20Server%202019%20%E4%B8%8A%E7%9A%84%20OpenSSH%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%97%B6%E5%85%AC%E9%92%A5%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5.png)
我正在尝试通过 SSH 连接到 Windows Server 2019,以便使用 GitLab CI/CD 管道部署我的 Web 应用程序,因此我在其上安装了 OpenSSH 服务器,如果我使用密码验证登录,一切都正常。
Start-service sshd
但是,如果我通过 Powershell 或使用类似的 GUI启动服务services.msc
,则无法连接,连接会关闭并显示debug3: recv - from CB ERROR:10054, io:000001AE1C4C53E0
消息
以下是使用选项连接时 ssh 客户端上的最后几行输出-vvv
:
Authenticated to x.x.x.x ([x.x.x.x]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug3: This windows OS supports conpty
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug3: Successfully set console output code page from:65001 to 65001
debug3: Successfully set console input code page from:950 to 65001
debug3: recv - from CB ERROR:10054, io:000001AE1C4C53E0
debug3: send packet: type 1
debug3: send - WSASend() ERROR:10054, io:000001AE1C4C53E0
client_loop: send disconnect: Connection reset
debug3: Successfully set console output code page from 65001 to 65001
debug3: Successfully set console input code page from 65001 to 950
在服务器端,还记录了一些错误:
debug1: monitor_read_log: child log fd closed
13012 2023-01-12 13:47:15.466 error: lookup_principal_name: User principal name lookup failed for user 'domain\\user' (explicit: 5, implicit: 5)
13012 2023-01-12 13:47:15.467 debug1: generate_s4u_user_token: LsaLogonUser() failed. User 'domain\\user' Status: 0xC0000062 SubStatus 0.
13012 2023-01-12 13:47:15.467 debug3: get_user_token - unable to generate token for user domain\\user
13012 2023-01-12 13:47:15.474 error: lookup_principal_name: User principal name lookup failed for user 'domain\\user' (explicit: 5, implicit: 5)
13012 2023-01-12 13:47:15.474 debug1: generate_s4u_user_token: LsaLogonUser() failed. User 'domain\\user' Status: 0xC0000062 SubStatus 0.
13012 2023-01-12 13:47:15.474 error: get_user_token - unable to generate token on 2nd attempt for user domain\\user
13012 2023-01-12 13:47:15.474 error: unable to get security token for user domain\\user
13012 2023-01-12 13:47:15.474 fatal: fork of unprivileged child failed
13012 2023-01-12 13:47:15.474 debug1: do_cleanup
我曾经以为这是由于sshd
用户权限不够造成的,所以我尝试添加sshd
到管理员,但没有帮助......
但是如果我通过运行手动启动服务C:\Windows\System32\OpenSSH\sshd.exe
,一切都正常......
对此有什么想法吗?