表单: LinuxNotes
用户: dreamable
创建日期: 2021-05-12 11:21:28 UTC
更新日期: 2021-05-12 11:21:39 UTC
引用:(Table ID 28, Record ID 3)

标题 :
How do I resolve a ssh connection closed by remote host due to inactivity?
笔记 :

source

  • Add to .ssh/config
TCPKeepAlive yes
ServerAliveInterval 30
  • In command line
ssh -o TCPKeepAlive=yes user@some.host.com
ssh -o ServerAliveInterval=30 user@some.host.com

TCPKeepAlive: This uses the KEEPALIVE option of the TCP/IP protocol to keep a connection alive after a specified interval of inactivity. On most systems, this means 2 hours. So, with the TCPKeepAlive option passed to SSH, the SSH client will send an encrypted packet to the SSH server, keeping your TCP connection up and running.

ServerAliveInterval: This sets a timeout interval in seconds, which is specified by you, from which if no packets are sent from the SSH client to the SSH server, SSH will send an encrypted request to the server for a TCP response. To make that request every 30 seconds:

标签: