最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】SecureCRT中通过SSH2连接登陆远程Linux但空闲一段时间后就断掉了

SecureCRT crifan 6032浏览 0评论

【背景】

之前遇到过很多次了:

在SecureCRT中通过SSH2登陆远程Linux主机,正常操作。

然后空闲了一段时间后,比如就几十秒,不算长的时间,然后再切换到SecureCRT界面中,去操作,结果就无法输入了:

看起来好像是中断了连接了。

【解决过程】

1.搜:

securecrt ssh2 cannot input after idle sometime

参考:

SecureCRT – FAQ

看到了解释:

Is there anything that can be done to prevent a connection from closing?

If you find your sessions being disconnected after a certain period of inactivity, you can take advantage of anti-idle features in SecureCRT to try and keep connections open for longer periods of time. You can find two anti-idle options in the Session Options / Terminal category: Send protocol NO-OP and Send string.

The Send protocol NO-OP option is available when using the SSH2 or the Telnet protocol. It sends data at the TCP protocol level and does not send any data to the remote which would be displayed. The Send protocol NO OP option is the suggested mechanism for anti-idle since it will typically not interfere with applications running on the remote system.

The Send string option simulates an actual key-press, so the data to send is sent to the remote and will be displayed (possibly interfering with an application running on the remote system). Since sending a key-press might have unintended consequences, the data to send should be chosen carefully. Simulating a space and backspace may be an optimal solution for many environments. To send space and backspace, enter " \b" (without quotes) in the Send string entry box.

过了段时间没有操作,就会主动断开。

那是因为SecureCRT有这个功能,目的是为了防止长时间不操作却仍旧保持连接。

而此处想要实现的是:

的确还保留,长期不操作就断开,但是要把时间设置的长一点:

否则每次没过多少秒不操作,结果就断开了。。。

 

2.然后去找到对应的配置选项:

settings terminal anti-idle not selecct

然后去使用第二种的策略:

选上:

Send protocol NO-OP,保持默认的 每个60秒就发一次

select send protocol no-op every 60 senconds

希望这样可以避免:

每次切换到别的界面(很短的时间之后)再回来,(连接就断开了)就无法继续操作了。

【总结】

到SecureCRT中设置:

Session Options->Terminal->Anti-idle->Send protocol NO-OP, evry 60 seconds

即可设置为,每隔一段时间发送NO-OP到服务器,即可避免长期不操作而连接断掉。

转载请注明:在路上 » 【已解决】SecureCRT中通过SSH2连接登陆远程Linux但空闲一段时间后就断掉了

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

网友最新评论 (1)

  1. Anti-idle 设置里面send string不要设置成其他字符串,最佳方式是\000 ,即内容为空
    goodman7年前 (2018-01-17)回复
83 queries in 0.196 seconds, using 22.22MB memory