Ubuntu18.04系统如何修改ssh会话保持时间
发布时间:2023-1-6 13:40:35 来源: 纵横云
Ubuntu18.04系统如何修改ssh会话保持时间
使用ssh链接服务端,有一段时间不操作的时候,ssh会自动断开连接。那么在ubuntu18.04系统中如何修改ssh会话的保持时间呢?本文给出详细说明。
1.首先打开sshd_config配置文件
vi /etc/ssh/sshd_config

2.在文件中找到ClientAliveInterval和ClientAliveCountMax两项,去掉前面的注释#,并将后面的数值改成自己需要的。
说明:如果没有找到,就自己在文件中增加这两项。
ClientAliveInterval 是服务器每隔(秒) 传送讯息给客户端,客户端收到讯息会回传以维持连线。其中预设数值为0代表不发送。例如设置ClientAliveInterval 60就代表每分钟发送一次。
ClientAliveCountMax 是经过几次客户端没回应,服务器结束连线。

修改后

3.保存退出,重启sshd生效
service sshd restart
4.修改完成
本文来源:
https://www.zonghengcloud.com/article/9159.html
[复制链接]
链接已复制