SSH Connection Timeout Resolution _linux

Source: Internet
Author: User

1. Modify server-side Etc/ssh/sshd_config

Copy Code code as follows:

Clientaliveinterval #server每隔60秒发送一次请求给client, then the client responds, thus keeping the connection
Clientalivecountmax 3 #server发出请求后, the client does not respond to the number of times reached 3, automatically disconnected, normally, client will not be unresponsive

2. Modify the etc/ssh/ssh_config of the client side to add the following: (without permission to change server configuration)

Copy Code code as follows:

Serveraliveinterval #client每隔60秒发送一次请求给server, and then the server responds, thus keeping the connection
Serveralivecountmax 3 #client发出请求后, the server side does not respond to the number of times reached 3, automatically disconnected, under normal circumstances, the server will not be unresponsive

Another way:
Do not modify the configuration file
In the command arguments Ssh-o serveraliveinterval=60 This will only maintain a persistent connection in the desired connection, after all, not all connections should remain persistent

For example:
In accordance with the first option, you need to restart the SSH service after the modification, OK:

Copy Code code as follows:

PISOWEBSV02:/ETC/SSH # service Sshd
Usage:/etc/init.d/sshd {start|stop|status|try-restart|restart|force-reload|reload|probe}
PISOWEBSV02:/ETC/SSH # service Sshd restart
Shutting down SSH Daemon done
Starting SSH Daemon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.