使用在 Cygwin 上运行的 SSH 服务器进行公钥身份验证 - 会话立即关闭

使用在 Cygwin 上运行的 SSH 服务器进行公钥身份验证 - 会话立即关闭

我正在通过 SSH 从 Linux 连接到在 Cygwin 中运行 SSH 的 Windows 计算机。我使用证书进行身份验证。会话打开但随后立即关闭。使用密码验证,它运行良好 - 会话保持活动状态,直到我注销。

我对服务器设置既不了解,也无法控制,但他们的管理员无法对其进行故障排除,因为他自己对 Linux 和 SSH 的了解有限。

因此,我试图确定导致这种行为的可能原因,以便我可以将此信息传递给管理员,然后管理员可以修复他们的设置。

当我运行 ssh 并打开详细输出时,我得到以下信息:

debug1: Trying private key: /home/user/.ssh/identity
debug1: Offering public key: /home/user/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp [some MAC-like sequence]
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/user/.ssh/id_rsa': 
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Last login: Mon Oct 18 20:19:58 2010 from ip-xyz
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
Connection to example.com closed.
Transferred: sent 2544, received 3160 bytes, in 0.2 seconds
Bytes per second: sent 10327.0, received 12827.5
debug1: Exit status 255

(我编辑了一些可以识别但可能毫无意义的部分)

因此看起来,客户端在登录后立即收到一些它不喜欢的位并关闭连接。

(这是来自 SU 的转帖https://superuser.com/questions/200756/,它可能不属于这里)

答案1

猜测一下:

服务器上的 ~/.ssh/authorized_keys 中是否有任何“强制命令”或任何其他限制?如果那里的行以“ssh-rsa AAAAB3Nz”开头,那么该方向上的一切都应该没问题。

相关内容