ssh登陆报错:packet_write_wait: Connection to x.x.x.x port 22: Broken pipe

参考文章:

https://patrickmn.com/aside/how-to-keep-alive-ssh-sessions/

用 ssh 命令连接服务器之后,如果一段时间不操作,再次进入 Terminal 时会有一段时间没有响应,然后就出现错误提示:

packet_write_wait: Connection to 47.92.226.106 port 22: Broken pipe

只能重新用 ssh 命令进行连接。

Solution:

1.如果有多台服务器,不想在每台上设置,只需在客户端设置即可:

  • 全部都保持连接:(root access required), edit /etc/ssh/ssh_config
  • 只在你的user上设置:edit ~/.ssh/config (create the file if it doesn’t exist)
Host *
  ServerAliveInterval 300
  ServerAliveCountMax 2

2. 如果有多台个人管理服务器,可以在服务器端配置:(没有效果!!)

make your OpenSSH server keep alive all connections with clients by adding the following to /etc/ssh/sshd_config:

ClientAliveInterval
ClientAliveCountMax

这些设置让ssh client or server发送一个空包到另一端,每5分钟一次。

如果它在尝试了2次后,仍没有收到任何响应,则放弃。即连接被断开了。

通过man ssu_config可以看到详细说明:

SYNOPSIS
~/.ssh/config
/etc/ssh/ssh_config DESCRIPTION
ssh() obtains configuration data from the following sources in the following
order: . command-line options
. user's configuration file (~/.ssh/config)
. system-wide configuration file (/etc/ssh/ssh_config)

ssh登陆报错:packet_write_wait: Connection to x.x.x.x port 22: Broken pipe的更多相关文章

  1. ssh 登录报错 packet_write_wait: Connection to x.x.x.x port 22: Broken pipe

    问题 更新个人博客文章时遇到:Error: packet_write_wait: Connection to 192.30.253.113 port 22: Broken pipe packet_wr ...

  2. SSH服务:packet_write_wait: Connection to 67.218.143.160 port 22: Broken pipe错误处理

    1.在~/.ssh/config配置文件中添加 IPQoS lowdelay throughput 2.在/etc/ssh/ssh_config配置文件中添加 IPQoS lowdelay throu ...

  3. SSH错误:packet_write_wait: Connection to 10.57.19.250 port 22: Broken pipe

    现象:ssh连接以后,服务器会主动断开连接,wireshark抓包,发线服务器会tcp rst,断开ssh连接 解决尝试:1.修改会话超时时间:2.客户端主动间隔性向服务器发送保活报文:3.服务端主动 ...

  4. 容器下载的是centos8的镜像,scp出现packet_write_wait: Connection to **** port 22: Broken pipe 问题解决

    解决方案:在~/.ssh目录新建文件config vi ~/.ssh/config         #Added lines to fix.    Host *    IPQoS lowdelay t ...

  5. idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost connection toMySQL server at

    我是使用navicat的windows端 连接centos下mysql服务器 第一次常规连接mysql正常,idea启动服务连接mysql后 Navicat连接mysql就报错2013-Lost co ...

  6. 关于tp.5.0角色管理导致的创建角色登陆报错问题解决!

    今天用tp 5.0的时候,遇到一个问题,就是在利用超级管理员创建管理员角色时,角色账号密码登陆报错的问题 解决方法如下 htaccess文件修改如下 <IfModule mod_rewrite. ...

  7. ab压力测试报错: apr_socket_recv: Connection reset by peer (104)

    使用ab对网站进行压力测试,开始设置并发500,可以正常使用,当设置并发为1000,则报错: apr_socket_recv: Connection reset by peer (104) 改服务端a ...

  8. 【MySQL8】 安装后的简单配置(主要解决navicat等客户端登陆报错问题)

    一.navicat等客户端登陆报错的原因 使用mysql,多数我们还是喜欢用可视化的客户端登陆管理的,个人比较喜欢用navicat.一般装好服务器以后,习惯建一个远程的登陆帐号,在mysql8服务器上 ...

  9. MVC模式下unity配置,报错“No connection string named '**Context' could be found in the application config file”

     写在前面: 第一次配置时好好的,后来第二次改到MVC模式,把依赖注入写成字典的单例模式时,由于新建的ORM(数据库映射模型EF),怎么弄都不用,一直报错"No connection str ...

随机推荐

  1. LOIC

    Pre: http://sourceforge.net/projects/loic Getting the Software To DDos, first your going to have to ...

  2. topcoder srm 699 div1 -3

    1.两个长度为$n$的数组$a,b$,$0 \leq a_{i} <2^{30}$.$b_{i}=-1$或者$b_{i}$为除$a_{i}$外其他数字的抑或值.现在给定$b$,如果不存在$a$, ...

  3. Ubuntu 汉字显示一半的修复

    部分汉字(例如“复”)显示不正常,只显示一半,其原因是Ubuntu采用的字体Noto Sans CJK优先显示日文汉字,这一问题可以通过修改配置文件/etc/fonts/conf.avail/64-l ...

  4. SPOJ 694 DISUBSTR - Distinct Substrings

    思路 求本质不同的子串个数,总共重叠的子串个数就是height数组的和 总子串个数-height数组的和即可 代码 #include <cstdio> #include <algor ...

  5. 使用CSS实现三栏自适应布局(两边宽度固定,中间自适应)

    来源:http://blog.csdn.net/cinderella_hou/article/details/52156333 所谓三列自适应布局指的是两边定宽,中间block宽度自适应.这道题在今年 ...

  6. 【译】第16节---数据注解-Table

    原文:http://www.entityframeworktutorial.net/code-first/table-dataannotations-attribute-in-code-first.a ...

  7. HDU 5236 Article(概率DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=5236 题意:现在有人要在文本编辑器中输入n个字符,然而这个编辑器有点问题. 在i+0.1s(i>=0)的时 ...

  8. JavaScript基本内容

    注释: /*多行 注释*/ //单行注释 变量: //变量均为对象,常用类型:String.Number.Boolean.Array.Object var value = "hello&qu ...

  9. SVN的常用功能使用教程

    (一)导入项目到版本库中 1. 在SVN服务器的仓库中新建项目名称文件夹 2. 选择安装Visual SVN的本地计算机中的一个文件夹,右键选择导入,将本地项目导入到SVN服务中央仓库中 3. 输入在 ...

  10. [从零开始搭网站三]CentOS配置JDK

    点击下面连接查看从零开始搭网站全系列 从零开始搭网站 上一章我介绍了,如何不用每次都输密码连接服务器.那么这一章终于要开始服务器的开发环境配置了. 1:先输入以下代码来检验有没有已经安装的CDK: r ...