自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

ssh超時斷開的解決方法

系統(tǒng) Linux
當(dāng)用SSH Secure Shell連接Linux時,如果幾分鐘沒有任何操作,連接就會斷開,必須重新登陸才行,每次都重復(fù)相同的操作,很是煩人,本文總結(jié)了兩種解決的方法。

當(dāng)用SSH Secure Shell連接Linux時,如果幾分鐘沒有任何操作,連接就會斷開,必須重新登陸才行,每次都重復(fù)相同的操作,很是煩人,本文總結(jié)了兩種解決的方法。

方法1:更改ssh服務(wù)器的配置文件/etc/ssh/sshd_config

ClientAliveInterval指定了服務(wù)器端向客戶端請求消息的時間間隔, 默認是0,不發(fā)送。而ClientAliveInterval 60表示每分鐘發(fā)送一次,然后客戶端響應(yīng),這樣就保持長連接了。這里比較怪的地方是:不是客戶端主動發(fā)起保持連接的請求(如FTerm, CTerm等),而是需要服務(wù)器先主動。

另外,至于ClientAliveCountMax,使用默認值3即可。ClientAliveCountMax表示服務(wù)器發(fā)出請求后客戶端沒有響應(yīng)的次數(shù)達到一定值,就自動斷開,正常情況下,客戶端不會不響應(yīng)。

ClientAliveCountMax

Sets the number of client alive messages (see below) which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the ses-sion. It is important to note that the use of client alive messages is very different from TCPKeepAlive (below). The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive.The default value is 3. If ClientAliveInterval (see below) is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. This option applies to protocol version 2 only.

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.

vim /etc/ssh/sshd_config

找到ClientAliveInterval 參數(shù),如果沒有就自己加一行。

ClientAliveInterval 參數(shù)的數(shù)值是秒,比如你設(shè)置為540,就是9分鐘.

ClientAliveInterval 540

對于ClientAliveCountMax

指如果發(fā)現(xiàn)客戶端沒有相應(yīng),則判斷一次超時,這個參數(shù)設(shè)置允許超時的次數(shù),比如10。

ClientAliveInterval 540

ClientAliveCountMax 10;

則代表允許超時 5400秒 = 90分鐘。

方法2:配置客戶端

1 linux下的ssh命令

vim /etc/ssh/ssh_config

然后找到里面的ServerAliveInterval 參數(shù),如果沒有你同樣自己加一個就好了。參數(shù)意義相同,都是秒數(shù),比如9分鐘:

ServerAliveInterval 540

2 SecureCRT

設(shè)置反空閑,如下圖所示

 securecrt_to

3 Putty

啟用putty keepalive

putty -> Connection -> Seconds between keepalives ( 0 to turn off ),默認為0,改為60。
 

【編輯推薦】

  1. Linux實戰(zhàn):用SSH遠程管理RHEL 5
  2. 淺析Linux服務(wù)器OpenSSH的源碼編譯與升級
  3. RSH/SSH配置Linux之間互信連接
責(zé)任編輯:趙寧寧 來源: chinaitlab
相關(guān)推薦

2009-07-22 17:50:14

2010-07-15 14:01:12

telnet亂碼

2011-03-01 13:40:45

500 OOPS

2009-09-10 09:35:25

Linq語句

2009-07-03 18:14:27

Servlet線程安全

2010-04-20 16:46:41

Oracle數(shù)據(jù)庫密碼

2010-10-13 17:22:12

MySQL查詢亂碼

2023-04-06 15:21:34

IIoT自動化

2011-09-16 15:36:47

網(wǎng)絡(luò)環(huán)路

2009-06-12 16:17:48

Hibernate l

2011-03-01 15:38:44

Fireftp亂碼

2010-05-25 16:37:47

MySQL忘記密碼

2010-02-23 13:07:07

CentOS gcc

2010-11-16 16:07:32

oracle用戶連接

2012-08-15 14:01:18

2011-06-27 09:23:05

Ubuntu密碼

2011-05-16 09:54:22

mysql1067錯誤

2010-05-27 09:33:04

SVN沖突

2014-09-01 16:45:06

DNS域名劫持

2010-06-17 10:32:13

開機顯示Grub
點贊
收藏

51CTO技術(shù)棧公眾號