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. 逆波兰表达式|2013年蓝桥杯A组题解析第六题-fishers

    逆波兰表达式 正常的表达式称为中缀表达式,运算符在中间,主要是给人阅读的,机器求解并不方便. 例如:3 + 5 * (2 + 6) - 1 而且,常常需要用括号来改变运算次序. 相反,如果使用逆波兰表 ...

  2. R t-test cor.test

    a = c(175, 168, 168, 190, 156, 181, 182, 175, 174, 179)b = c(185, 169, 173, 173, 188, 186, 175, 174, ...

  3. SPOJ 694 DISUBSTR - Distinct Substrings

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

  4. vue的全局方法和局部方法

    var infiniteScroll = require('vue-infinite-scroll') 等价写法 import infiniteScroll from 'vue-infinite-sc ...

  5. [bootstrapValidator] - bootstrap的验证工具

    翻了下之前和同事做的一个验证 <!--bootstrapValidator--> <script type="text/javascript" th:inline ...

  6. 4-Five-Youth

      ①People are always talking about 'the problem of youth'. If there is one--which I take leave to do ...

  7. it做形式主语的句子

    1. it was considerate of you to visit my mother every day and (to) bring me your notes to help me wi ...

  8. .NET 介绍

    In order to continue our effort of being modular and well factored we don’t just provide the entire ...

  9. HDU 1247 Hat’s Words(字典树)

    http://acm.hdu.edu.cn/showproblem.php?pid=1247 题意: 给出一些单词,问哪些单词可以正好由其他的两个单词首尾相连而成. 思路: 先将所有单独插入字典树,然 ...

  10. python学习 day011打卡 迭代器

    本节的主要内容: 1.函数名的使用以及第一类对象 2.闭包 3.迭代器 一.函数名的运用. 函数名是一个变量,但它是一个特殊的变量,与括号配合可以执行函数的变量. 1.函数名的内存地址 def fun ...