ssh连接长时间不操作自动断开问题解决

解决方法: 修改服务器ssh连接参数

在服务器端编辑sshd服务的配置文件

sudo vim /etc/ssh/sshd_config

在文件最后添加

# 每60秒连接一下客户端
ClientAliveInterval 60
# 最大重试次数为5次
ClientAliveCountMax 5

保存退出后重启ssh服务即可

systemctl restart ssh

修改后时间异常仍然会提示 systemctl restart sshtimed out waiting for input: auto-logout

这个时候修改/etc/profile

vi /etc/profile

将里边的TMOUT=1800注释掉 ,改为

#TMOUT=1800

在文件最后添加

export TMOUT=0

使文件立刻生效

source /etc/profile
posted @ 2022-10-27 19:17  iminifly  阅读(218)  评论(0编辑  收藏  举报