Home  >  Article  >  Web Front-end  >  Linux maintains ssh connection implementation code

Linux maintains ssh connection implementation code

小云云
小云云Original
2018-02-28 13:56:461905browse

Often when we use ssh to remotely connect to a host, the connection will be automatically disconnected due to no operation for a long time, which is very inconvenient.
By configuring the ssh server or client, we can maintain the ssh connection.

Server configuration

vim /etc/ssh/sshd_config, add the following configuration:

# 表示每30秒服务端就向客户端发送一个数据包来保持连接
ClientAliveInterval 30
# 如果发送了60次客户端都还没有回应,就断开连接
ClientAliveCountMax 60

Client configuration

vim /etc/ssh/ssh_config, add the following configuration:

# 表示每30秒服务端就向服务端发送一个数据包来保持连接
ServerAliveInterval 30
# 如果发送了60次服务端还没有回应就断开连接
ServerAliveCountMax 60

Related recommendations:

How to connect to Mysql database through SSH?

Detailed explanation of the integration of the three major frameworks in SSH

Establishing ftp, nfs, and ssh servers in Linux


The above is the detailed content of Linux maintains ssh connection implementation code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn