ssh 登录和注销速度缓慢,“通道上接受了 shell 请求”

ssh 登录和注销速度缓慢,“通道上接受了 shell 请求”

我有一个缓慢的 ssh 登录问题,服务器速度很快(通过 wget),但弹出 shell 需要 15 秒。

所以我用 -vv 选项启动 ssh,我发现它卡在了 pty 请求上:

debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: channel_input_open_confirmation: channel 0: 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 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0  <-- stuck for 15s

起初我怀疑这是 bash 配置文件,但是添加-x到 /etc/profile 并没有帮助,控制台上没有打印任何内容。但是如果我按 ^C,控制台上会打印大量输出。

当我退出 shell 时,它也卡住了大约 10 秒,然后打印了以下几行:

debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o0 sock -1 wfd 8 efd 10 [write])
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: chan_shutdown_write (i3 o1 sock -1 wfd 9 efd 10 [write])
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
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 xxxx closed.
Transferred: sent 3296, received 2720 bytes, in 78.5 seconds
Bytes per second: sent 42.0, received 34.7
debug1: Exit status 0

有谁知道如何调试这个问题?我现在完全不知道了。

答案1

检查您是否使用有效的名称服务器或是否UseDNS no放入/etc/ssh/sshd_config.

相关内容