search

Home  >  Q&A  >  body text

linux - SSH connection to the server gets stuck after a period of inactivity. What's going on?

Connected to the server through ssh from the terminal. There was no operation for a period of time. When I tried to operate again, I found that it was stuck. I could only exit and reconnect.
What's going on? Did the connection disconnect itself?

仅有的幸福仅有的幸福2752 days ago662

reply all(1)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:23:20

    It seems that you are using a linux system
    This is a security issue of linux. If no data is used within 60s, it will be automatically disconnected.
    So you found the card owner~~~

    Solution

    #本地
    #打开
    sudo vim /etc/ssh/ssh_config
    # 添加
    ServerAliveInterval 50
    ServerAliveCountMax 3 
    
    #远程
    # 打开
    sudo vim /etc/ssh/sshd_config
    # 添加
    ClientAliveInterval 50
    ClientAliveCountMax 3 

    reply
    0
  • Cancelreply