解决Mac下SSH闲时自动断开的问题

栏目: 服务器 · 发布时间: 6年前

内容简介:使用 Mac 自带终端 SSH 连接服务器时,只要隔一小段时间不进行操作的话连接就会自动中断,造成了不好的体验。解决方法如下:1、连接到你的服务器2、编辑服务端配置文件 /etc/ssh/sshd_config

使用 Mac 自带终端 SSH 连接服务器时,只要隔一小段时间不进行操作的话连接就会自动中断,造成了不好的体验。解决方法如下:

1、连接到你的服务器

2、编辑服务端配置文件 /etc/ssh/sshd_config

vim /etc/ssh/sshd_config

添加以下两行配置代码

ClientAliveInterval 30
ClientAliveCountMax 3

3、编辑客户端配置文件 /etc/ssh/ssh_config

vim /etc/ssh/ssh_config

在 Host * 下面添加以下两行配置代码

ServerAliveInterval 30
ServerAliveCountMax 3

4、断开SSH连接

Ctrl + d

5、SSH 重连服务然后执行重启

sync 将数据由内存同步到硬盘中。
reboot 就是重启

重启后可能需要等待1分钟左右才能重新连接上。

最后验证测试就可以了。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Chinese Authoritarianism in the Information Age

Chinese Authoritarianism in the Information Age

Routledge / 2018-2-13 / GBP 115.00

This book examines information and public opinion control by the authoritarian state in response to popular access to information and upgraded political communication channels among the citizens in co......一起来看看 《Chinese Authoritarianism in the Information Age》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具