方案一:客户端发心跳数据包
1.设置服务器文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/554.html
1.1 修改服务器中/etc/ssh/sshd.config 文件,将LoginGraceTime的值设为0,TCPKeepAlive 设为yes文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/554.html
1.2 service sshd restart 重启sshd服务。文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/554.html
2.设置PuTTY左侧Connection 项目中设定 "Sending of null packets to keep session active",设置为每隔几秒发送一个数据包,保持session不会过期。如下文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/554.html

图我设置的10秒文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/554.html
方案二:服务端发心跳数据包
打开服务器 /etc/ssh/sshd_config,我在最后增加一行
ClientAliveInterval 60
ClientAliveCountMax 1
这 样,SSH Server 每 60 秒就会自动发送一个信号给 Client,而等待 Client 回应
文章末尾固定信息












