解决ssh链接服务器超时自动断开的问题

为了安全性;
ssh默认的连接超时时间很短;
经常就是发个呆就断开了;
事实上是可以修改超时时间的。
示例环境:
服务器:centos7

[root@iZwz9exe2jul8fc4gtaydyZ log]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)


1.先备份下配置项;
养成备份配置项的好习惯;

cp /etc/ssh/sshd_config sshd_config.bak

2.编辑sshd_config文件

删除ClientAliveInterval 0 前面的注释#号 并改为ClientAliveInterval 600
删除lientAliveCountMax 3 前面的注释#号 并改为ClientAliveCountMax 10

3.重启下ssh服务

service sshd reload;
/etc/init.d/sshd restart;

转自大海技术博客 https://www.ypyunedu.com/article/90

发布了263 篇原创文章 · 获赞 46 · 访问量 37万+

猜你喜欢

转载自blog.csdn.net/qq_27229113/article/details/104550323
今日推荐