阿里云SSH连接保持心跳
- 修改配置文件
vim /etc/ssh/sshd_config
- 设置心跳发送间隔 服务器超时间隔时间
ClientAliveInterval 30
ClientAliveCountMax 1800
ClientAliveInterval:客户端向服务器发送心跳数据的时间,单位是秒。
ClientAliveCountMax:客户端间隔多少秒没有响应,服务器自动中断连接的时间,单位是秒。
- 重启sshd服务
service sshd restart
在重启aliyun ECS ssh的过程中,重启服务不再通过 service 操作,而是通过 systemctl 操作
- 查看sshd服务状态
systemctl status sshd.service
- 启动
systemctl start sshd.service
- 重启
systemctl restart sshd.service
- 自启动
systemctl enable sshd.service