在使用SSH管理服務器的時候,如果你很長一段時間不登錄,那麼很可能等待著你的就是
“寫入失敗: 斷管“
造成這個錯誤的原因是SSH空閒鏈接時間太長導致的,所以,我們需要修改SSH默認配置來讓它自動關閉鏈接。
在SSH的配置當中,有兩個命令可以實現這個功能,它們分別是
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//ServerAliveInterval Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. 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. |
這兩個命令[……]