AWS SSH 会话偶尔被服务器关闭

AWS SSH 会话偶尔被服务器关闭

我已使用 Windows 7 上的 putty(ppk 身份验证)连接到 AWS EC2 Ubuntu 实例。大多数时候,我在 putty 上收到此消息:网络错误:软件导致连接中止。但这种断线现象时有发生。

Putty 会话在“连接”下有以下设置:

  • Keepalive 间隔秒数:5(也尝试过 30)
  • 启用 TCP Keepalives:设置为 True(已选中)

我使用 Wireshark 捕获了网络数据包。它显示服务器正在向客户端系统发送连接重置信号。

我有 2 个 Putty 会话连接到同一台服务器。这就是它显示 2 个 RESET 数据包的原因。 在此处输入图片描述

这是 SSH 日志(auth.log)

May 13 07:38:52 aws-server-1 sshd[30699]: Accepted publickey for dev-user from xx.xx.xx.xx port 49235 ssh2
May 13 07:38:52 aws-server-1 sshd[30699]: pam_unix(sshd:session): session opened for user dev-user by (uid=0)
May 13 07:39:01 aws-server-1 sudo:    dev-user : TTY=pts/1 ; PWD=/home/dev-user ; USER=root ; COMMAND=/usr/bin/tail -f /var/log/syslog
May 13 07:39:01 aws-server-1 sudo: pam_unix(sudo:session): session opened for user root by dev-user(uid=1009)
May 13 07:39:01 aws-server-1 CRON[30961]: pam_unix(cron:session): session opened for user root by (uid=0)
May 13 07:39:01 aws-server-1 CRON[30961]: pam_unix(cron:session): session closed for user root
May 13 07:39:43 aws-server-1 sshd[30699]: pam_unix(sshd:session): session closed for user dev-user
May 13 07:39:43 aws-server-1 sudo: pam_unix(sudo:session): session closed for user root
May 13 07:39:44 aws-server-1 sshd[30025]: pam_unix(sshd:session): session closed for user dev-user

用户会话:

dev-user    pts/0        xx.xx.xx.xx      Wed May 13 07:40   still logged in
dev-user    pts/1        xx.xx.xx.xx      Wed May 13 07:38 - 07:39  (00:00)
dev-user    pts/0        xx.xx.xx.xx      Wed May 13 07:21 - 07:39  (00:18)
dev-user    pts/1        xx.xx.xx.xx      Wed May 13 06:36 - 07:13  (00:36)
dev-user    pts/0        xx.xx.xx.xx      Wed May 13 06:35 - 07:13  (00:37)
dev-user    pts/1        xx.xx.xx.xx      Wed May 13 06:09 - 06:10  (00:00)
dev-user    pts/0        xx.xx.xx.xx      Wed May 13 06:08 - 06:13  (00:04)
dev-user    pts/0        xx.xx.xx.xx      Wed May 13 05:12 - 06:04  (00:52)
dev-user    pts/0        xx.xx.xx.xx      Tue May 12 14:14 - 16:24  (02:10)
dev-user    pts/0        xx.xx.xx.xx      Tue May 12 13:27 - 13:39  (00:11)
dev-user    pts/0        xx.xx.xx.xx      Tue May 12 12:41 - 12:41  (00:00)
dev-user    pts/1        xx.xx.xx.xx      Tue May 12 10:39 - 10:39  (00:00)

以上所有会话均不由用户终止。所有会话均由服务器终止。我们没有更改任何 SSH 设置。

我该如何解决这个问题?

相关内容