通过客户端远程登录Linux,在一段时间没有操作后,连接将被断开,已经进入了目录和执行命令的记录将丢失。
以下方法可以延长连接的时间。
/etc/ssh/sshd_config中ClientAliveInterval默认被注释。将ClientAliveInterval的值设置为300秒。
...
vim /etc/ssh/sshd_config
ClientAliveInterval 300
...
重载sshd服务
systemctl reload sshd.service
ClientAliveInterval的意义
man sshd
man 5 sshd_config
ClientAliveInterval
Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted(加密) channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. This option applies to protocol(协议) version 2 only.
网友评论