Linux - SSH-保持连接

Linux - SSH-保持连接

方式一:服务端配置

vim /etc/ssh/sshd_config

修改参数:

1
2
3
ClientAliveInterval 60  # 服务端每 60s 向客户端发起一次响应
ClientAliveCountMax 10 # 如果客户端超过 10 次每响应则掐断连接
restart ssh / service ssh reload

方式二:客户端配置(推荐)

/etc/ssh/ssh_config 或者 ~/ssh/config 添加:

1
2
Host *
ServerAliveInterval 60

then:

1
chmod 600 ~/.ssh/config
# linux

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×