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

【背景】

之前遇到过很多次了:

在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到服务器,即可避免长期不操作而连接断掉。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量