美文网首页
SecureCRT 超时自动断开的解决方法

SecureCRT 超时自动断开的解决方法

作者: mutang | 来源:发表于2020-07-11 13:15 被阅读0次

原地址:https://blog.mimvp.com/article/18160.html

SecureCRT 远程登录连接Linux/Unix服务器时,一段时间不用会自动断开连接,需要重新连接,比较麻烦。

1. 服务器端配置

1.1 修改 /etc/profile 或 ~/.bash_profile

vim /etc/profile 或 vim ~/.bash_profile

TMOUT=1800 // 添加到 /etc/profile 文件最后一行,单位为秒,1800秒即为30分钟

source /etc/profile // 使修改生效

注意: TMOUT设置的服务器超时时间,一定要大于SecureCRT设置反空闲时间,不然还没反超时就自动断开了

1.2 修改 /etc/ssh/sshd_config

vim /etc/ssh/sshd_config

ClientAliveInterval 180 // 去掉#,设置为180秒,每隔3分钟服务器端向客户端请求一次消息的时间间隔;默认0,表示不发送
ClientAliveCountMax 3 // 去掉#,表示服务器向客户端发送请求没有响应的次数就自动断开;正常情况下, 客户端不会不响应

service sshd restart 或 service sshd reload // 使修改生效

注意:设置以后,SecureCRT一定要退出远程连接,重新登陆一次

2. 客户端配置

2.1 设置 NO-OP

Options -> Session Options -> Terminal -> Anti-idle -> (勾选) Send protocol NO-OP -> 60(单位秒,1分钟发送一次请求)

securecrt-chao-shi-zi-dong-duan-kai-de-jie-jue-fang-fa-01

2.2 全局设置

SecureCRT —> Preferences... —> Default Session —> Edit Default Settings —> Terminal -> Anti-idle -> (勾选) Send protocol NO-OP -> 60

securecrt-chao-shi-zi-dong-duan-kai-de-jie-jue-fang-fa-02

3. 验证生效

SecureCRT没有操作时,每隔60秒,自动发送一个换行符(\n)给服务器端,并在SecureCRT客户端执行换行操作

这样客户端和服务器端有操作连接,保证了远程连接的保持,不会掉线。

securecrt-chao-shi-zi-dong-duan-kai-de-jie-jue-fang-fa-03

putty -> Connection -> Seconds between keepalives ( 0 to turn off ), 默认为0, 改为300.

相关文章

网友评论

      本文标题:SecureCRT 超时自动断开的解决方法

      本文链接:https://www.haomeiwen.com/subject/fuficktx.html