Home >Web Front-end >JS Tutorial >Linux maintains ssh connection implementation code
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.
vim /etc/ssh/sshd_config
, add the following configuration:
# 表示每30秒服务端就向客户端发送一个数据包来保持连接 ClientAliveInterval 30 # 如果发送了60次客户端都还没有回应,就断开连接 ClientAliveCountMax 60
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!