如何保持SSH串連的linux伺服器不斷線

來源:互聯網
上載者:User

標籤:

windows系統

使用SecureCRT串連遠程伺服器,在會話選項 -> 終端設定中勾選“發送協議 NO-OP”。

使用putty串連遠程伺服器,找到Connection -> Seconds between keepalives ( 0 to turn off ), 預設為0,改為60。

Linux系統

在linux系統中使用ssh串連遠程伺服器時,可以使用-o的一個參數ServerAliveInterval來設定防止逾時的時間。

比如:ssh -o serveraliveinterval=60 username@host

伺服器配置修改

修改ssh設定檔/etc/ssh/sshd_config,添加或者修改ClientAliveInterval為“ClientAliveInterval 60”。這個參數的是意思是每1分鐘,伺服器向用戶端發一個訊息,用於保持串連。儲存後記得重啟ssh服務。

修改過後,上面幾個辦法都可以讓ssh保持串連,一直處於alive狀態,不會因為沒有操作而被伺服器強制斷線了。


如何保持SSH串連的linux伺服器不斷線

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.