密码验证有效,但连接到安装在 Windows Server 2019 上的 OpenSSH 服务器时公钥验证失败

密码验证有效,但连接到安装在 Windows Server 2019 上的 OpenSSH 服务器时公钥验证失败

我正在尝试通过 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到管理员,但没有帮助......

如何将 sshd 用户添加到管理员组

但是如果我通过运行手动启动服务C:\Windows\System32\OpenSSH\sshd.exe,一切都正常......

对此有什么想法吗?

相关内容