

vim /etc/ssh/sshd_config
- # 保持 tcp 连接活跃 Keep = 保持 Alive = 活跃
- TCPKeepAlive yes
- # Client Alive = 活跃 Interval = 间隔
- # 多长时间 向客户端发送一次请求,确认客户端还是alive的
- ClientAliveInterval 60
- #当发送请求达到一定次数时关闭连接
- ClientAliveCountMax 360
service sshd restart
启动
systemctl start sshd.service
重启 sshd 服务:
systemctl restart sshd.service
设置服务开启自启:
systemctl enable sshd.service