연결이 끊어지고 SSH가 활성화되면 터미널이 중단됩니다.

연결이 끊어지고 SSH가 활성화되면 터미널이 중단됩니다.

gnome 터미널 탭에서 인터넷을 통해 서버에 SSH로 접속할 때 인터넷 연결이 끊어지면 터미널 탭이 정지되고 입력이 허용되지 않습니다. 왜 멈추나요?

터미널 탭을 활성화하는 방법이 있습니까? 즉, 로컬 쉘 프로세스를 계속 실행하게 합니까?

터미널 탭을 닫는 것이 유일한 방법입니까?

답변1

ClientAliveIntervalSSH 연결은 ClientAliveCountMax매개변수 및 해당 클라이언트에 의해 설정된 지정된 시간이 지나면 자동으로 연결이 끊어집니다. 이러한 시간 초과가 상당히 길면 쉘이 정지되는 현상이 발생합니다. 그러나 다음을 사용하면 OpenSSH시간 초과를 기다릴 필요가 없습니다.이스케이프 문자:

ESCAPE CHARACTERS
When a pseudo-terminal has been requested, ssh supports a number
of functions through the use of an escape character.  A single
tilde character can be sent as ~~ or by following the tilde by a
character other than those described below. The escape character
must always follow a newline to be interpreted as special. The
escape character can be changed in configuration files using the
EscapeChar configuration directive or on the command line by the
-e option.
The supported escapes (assuming the default ‘~’) are:

~.
    Disconnect.
(...)

연결이 멈췄을 때 ( + 키를 함께 ~의미함 ) 누르고 손을 뗀 후 누르세요 . 또는 연결이 불안정하거나 항상 원격 서버에 연결해야 하는 경우 다음을 사용할 수 있습니다.Shift`.자동 SSH끊어진 연결을 자동으로 복원해 매우 편리합니다.

편집하다:

그러나 ClientAliveInterval및 둘 다 ServerAliveInterval명시적으로 0으로 설정되거나 명시적으로 설정되지 않은 경우 sshd_config시간 초과 ssh_config설정은 다음 파일에서 설정됩니다(http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html):

  # cat /proc/sys/net/ipv4/tcp_keepalive_time
  7200

  # cat /proc/sys/net/ipv4/tcp_keepalive_intvl
  75

  # cat /proc/sys/net/ipv4/tcp_keepalive_probes
  9

  The first two parameters are expressed in seconds, and the last is
  the pure number. This means that the keepalive routines wait for
  two hours (7200 secs) before sending the first keepalive probe,
  and then resend it every 75 seconds. If no ACK response is
  received for nine consecutive times, the connection is marked as
  broken.

간단히 사용하여 이 3개 파일을 수정할 수 echo있으며 이 값을 기반으로 고정된 SSH 세션의 연결이 끊어졌음을 직접 확인할 수 있습니다.

관련 정보