3月 052017
 

转载自:http://blog.csdn.net/quqi99/article/details/51434248

SSH连接总是隔一段时间没有输入时就断开,解决办法如下:

方法一:修改服务端配置
sudo vi /etc/ssh/sshd_config
ClientAliveInterval 60 #服务端主动向客户端请求响应的间隔
ClientAliveCountMax 10 #服务器发出请求后客户端没有响应的次数达到一定值就自动断开
sudo restart ssh

方法二:修改客户端配置
sudo vi /etc/ssh/ssh_config #或~/.ssh/config

TCPKeepAlive=yes
ServerAliveInterval 60 #客户端主动向服务端请求响应的间隔

ssh -i <key-file> -o StrictHostKeyChecking=no -o TCPKeepAlive=yes -o ServerAliveInterval=30 ubuntu@<ip>

上面方式任选一种,我选客户端配置方式。

 

打赏
 Posted by on 2017-03-05  标签:

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

* Copy This Password *

* Type Or Paste Password Here *

11,769迄今阻止垃圾评论Spam Free Wordpress