Amazon ec2 使用ubuntu在Amazon EC2上使用ssh冻结连接

Amazon ec2 使用ubuntu在Amazon EC2上使用ssh冻结连接,amazon-ec2,Amazon Ec2,当我使用secure shell连接到Amazon EC2并且几分钟内不键入任何内容时,所有内容都会冻结。我无法键入任何内容或退出。几分钟后,我从服务器收到一条消息 最后一次登录:Fri Dec 6 23:21:28 2013从pool-173-52-249-158.nycmny.east.verizon.net ubuntu@ip-172-31-31-33:~$Write失败:管道破裂 你们中的一些人以前不得不有这个问题。如果你能为使用云计算的新手提供一些信息。请尝试以下选项: 浏览Serve

当我使用secure shell连接到Amazon EC2并且几分钟内不键入任何内容时,所有内容都会冻结。我无法键入任何内容或退出。几分钟后,我从服务器收到一条消息

最后一次登录:Fri Dec 6 23:21:28 2013从pool-173-52-249-158.nycmny.east.verizon.net ubuntu@ip-172-31-31-33:~$Write失败:管道破裂

你们中的一些人以前不得不有这个问题。如果你能为使用云计算的新手提供一些信息。

请尝试以下选项:

浏览
ServerAliveCountMax
ServerAliveInterval
。这些设置在ssh客户端的
/etc/ssh/ssh\u config
中设置

manssh\u config

ServerAliveCountMax
             Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any mes‐
             sages back from the server.  If this threshold is reached while server alive messages are being sent, ssh
             will disconnect from the server, terminating the session.  It is important to note that the use of server
             alive messages is very different from TCPKeepAlive (below).  The server alive messages are sent through
             the encrypted channel and therefore will not be spoofable.  The TCP keepalive option enabled by
             TCPKeepAlive is spoofable.  The server alive mechanism is valuable when the client or server depend on
             knowing when a connection has become inactive.

             The default value is 3.  If, for example, ServerAliveInterval (see below) is set to 15 and
             ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after
             approximately 45 seconds.  This option applies to protocol version 2 only; in protocol version 1 there is
             no mechanism to request a response from the server to the server alive messages, so disconnection is the
             responsibility of the TCP stack.
ClientAliveCountMax
             Sets the number of client alive messages (see below) which may be sent without sshd(8) receiving any mes‐
             sages back from the client.  If this threshold is reached while client alive messages are being sent,
             sshd will disconnect the client, terminating the session.  It is important to note that the use of client
             alive messages is very different from TCPKeepAlive (below).  The client alive messages are sent through
             the encrypted channel and therefore will not be spoofable.  The TCP keepalive option enabled by
             TCPKeepAlive is spoofable.  The client alive mechanism is valuable when the client or server depend on
             knowing when a connection has become inactive.

             The default value is 3.  If ClientAliveInterval (see below) is set to 15, and ClientAliveCountMax is left
             at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds.  This
             option applies to protocol version 2 only.

服务器端也提供了类似的设置,即
ClientAliveInterval
ClientAliveCountMax
。这些设置在服务器端的
/etc/ssh/sshd\u config

man sshd\u配置

ServerAliveCountMax
             Sets the number of server alive messages (see below) which may be sent without ssh(1) receiving any mes‐
             sages back from the server.  If this threshold is reached while server alive messages are being sent, ssh
             will disconnect from the server, terminating the session.  It is important to note that the use of server
             alive messages is very different from TCPKeepAlive (below).  The server alive messages are sent through
             the encrypted channel and therefore will not be spoofable.  The TCP keepalive option enabled by
             TCPKeepAlive is spoofable.  The server alive mechanism is valuable when the client or server depend on
             knowing when a connection has become inactive.

             The default value is 3.  If, for example, ServerAliveInterval (see below) is set to 15 and
             ServerAliveCountMax is left at the default, if the server becomes unresponsive, ssh will disconnect after
             approximately 45 seconds.  This option applies to protocol version 2 only; in protocol version 1 there is
             no mechanism to request a response from the server to the server alive messages, so disconnection is the
             responsibility of the TCP stack.
ClientAliveCountMax
             Sets the number of client alive messages (see below) which may be sent without sshd(8) receiving any mes‐
             sages back from the client.  If this threshold is reached while client alive messages are being sent,
             sshd will disconnect the client, terminating the session.  It is important to note that the use of client
             alive messages is very different from TCPKeepAlive (below).  The client alive messages are sent through
             the encrypted channel and therefore will not be spoofable.  The TCP keepalive option enabled by
             TCPKeepAlive is spoofable.  The client alive mechanism is valuable when the client or server depend on
             knowing when a connection has become inactive.

             The default value is 3.  If ClientAliveInterval (see below) is set to 15, and ClientAliveCountMax is left
             at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds.  This
             option applies to protocol version 2 only.

看起来您的防火墙(来自不同位置)由于不活动而正在删除会话

我会像@slayedbylucifer在~/.ssh/config中所说的那样尝试

Host *
    ServerAliveInterval 60

我在过去的一个月里也注意到了这一点,而我以前从未遇到过这个问题。我认为这可能是由我的网络引起的,但我在不同的地方经历过,有线和无线连接。我可能更适合在他们的开发者论坛上发布。我甚至注意到,一段时间后,如果我的shell没有被冻结,调用一个命令来打印随后的数据量(比如读取日志),最终会在显示第一行之后以同样的方式冻结它。好的,有一点时间了,但我还有一个问题。如何打开和编辑/etc/ssh/sshd_配置文件。我很熟悉命令行,但在客户端或服务器端都找不到该文件。它肯定会在服务器端找到。没有它SSH就无法工作。在客户端,您是否从PuTTy连接?