运行 sshd.exe 时可以连接服务器,但运行 *OpenSSH 服务器* 服务时则无法连接

运行 sshd.exe 时可以连接服务器,但运行 *OpenSSH 服务器* 服务时则无法连接

我正在尝试在 Windows Server Enterprise 2007 (SP2) 安装上设置 OpenSSH 服务器。参见标题。我已将以下几行添加到我的文件中,sshd_config以便OpenSSH 服务器服务(我将其简称为“服务”)将调试日志输出到%ProgramData%\ssh

# Logging
SyslogFacility LOCAL0
LogLevel DEBUG3

我尝试通过几个不同的客户端进行连接(我自己的电脑上没有安装 OpenSSH,并且由于其他原因试图避免安装),但它们都无法连接,并显示“连接已关闭”(SecureCRT)或“网络错误:软件导致连接中止”(PuTTY/WinSCP)等信息。调试日志显示以下内容:

25380 2020-03-26 17:54:44.326 debug1: Bind to port 22 on ::.
25380 2020-03-26 17:54:44.327 Server listening on :: port 22.
25380 2020-03-26 17:54:44.327 debug2: fd 4 setting O_NONBLOCK
25380 2020-03-26 17:54:44.327 debug1: Bind to port 22 on 0.0.0.0.
25380 2020-03-26 17:54:44.329 Server listening on 0.0.0.0 port 22.
25380 2020-03-26 17:54:56.983 debug3: fd 5 is not O_NONBLOCK
25380 2020-03-26 17:54:56.984 debug3: spawning "C:\\Program Files\\OpenSSH\\sshd.exe" -R
25380 2020-03-26 17:54:56.986 debug3: send_rexec_state: entering fd = 8 config len 326
25380 2020-03-26 17:54:56.986 debug3: ssh_msg_send: type 0
25380 2020-03-26 17:54:56.986 debug3: send_rexec_state: done
25380 2020-03-26 17:57:47.344 debug3: fd 5 is not O_NONBLOCK
25380 2020-03-26 17:57:47.345 debug3: spawning "C:\\Program Files\\OpenSSH\\sshd.exe" -R
25380 2020-03-26 17:57:47.347 debug3: send_rexec_state: entering fd = 8 config len 326
25380 2020-03-26 17:57:47.347 debug3: ssh_msg_send: type 0
25380 2020-03-26 17:57:47.347 debug3: send_rexec_state: done

同时,如果我运行sshd.exe -ddd并尝试连接,我会得到如下结果:

debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug2: fd 4 setting O_NONBLOCK
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug3: fd 5 is not O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug3: send_rexec_state: entering fd = 8 config len 326
debug3: ssh_msg_send: type 0
debug3: send_rexec_state: done
Connection from xxx.xxx.xxx.xxx port 53595 on xxx.xxx.xxx.xxx port 22
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version SecureCRT_8.5.1 (x6
4 build 1764)
debug1: no match: SecureCRT_8.5.1 (x64 build 1764)
debug2: fd 5 setting O_NONBLOCK
debug3: spawning "C:\\Program Files\\OpenSSH\\sshd.exe" -ddd -y
debug2: Network child is on pid 26544
debug3: send_rexec_state: entering fd = 4 config len 326
debug3: ssh_msg_send: type 0
debug3: send_rexec_state: done
debug3: ssh_msg_send: type 0
debug3: ssh_msg_send: type 0
debug3: preauth child monitor started

然后 OpenSSH 崩溃了(这显然是设计好的?)。

是的,我已经检查过设置正确的文件权限,添加了防火墙的入站规则, ETC。

我会说我是通过 VPN(Cisco AnyConnect)连接的,我想这会产生影响,但我不知道如何检查。任何帮助都非常感谢。

答案1

配置的 Match 部分出了问题,但您在日志中看不到它,因为在用户帐户下生成的 sshd.exe 没有权限写入日志(目录)一旦您允许用户修改日志目录,您将在成功验证后看到日志中的内容

相关内容