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. Shell脚本,更改Info.plist中的日期等

    #!/bin/bashroot_src=$(dirname $(PWD)) bundle_name='RandomDebbot.bundle' target_path=$root_src/ecovac ...

  2. Windows使用(类)Unix环境那些事

    之前的博文中有不少涉及到win下使用unix环境的一些东西,但都是为了做别的事情,还是写一个专门讲这个主题的文章吧. 主角:Cygwin.mingw-W64.MSYS2. 注:mingw已经停止更新很 ...

  3. github帐户和仓库的创建

    sign up is registration and sign in is logging in for "in" is to enter an existing account ...

  4. Linux/shell: remove adjacent similar patterns

    cat > temp004AA1abcAA2AA3abcAA4abcAA5AA6 awk 'BEGIN {pre=0; str="";} { if(NR==1){     i ...

  5. P2163 [SHOI2007]园丁的烦恼(cdq分治)

    思路 其实是cdq的板子 题目要求询问对于每个给出的xi,yi,xj,yj形如xi<=x<=xj.yi<=y<=yj的x,y对数有多少组 改成四个询问,拆成四个前缀和的形式后就 ...

  6. CF161D Distance in Tree(点分治)

    点分治是一种处理树的优秀暴力 这是一道板子题 #include <cstdio> #include <cstring> #include <algorithm> u ...

  7. 51nod 1615 跳跃的杰克

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1615 题意: 思路:一开始是觉得一旦超过了终点,中间某个地方往相反地方跳 ...

  8. jqGrid API (转)

    来源:https://www.cnblogs.com/MonaSong/p/5109991.html JQGrid是一个在jquery基础上做的一个表格控件,以ajax的方式和服务器端通信. JQGr ...

  9. QT读文件夹内所有文件名

    void monizhuzhan::filenameInDir() { //判断路径是否存在 QDir dir(path); if(!dir.exists()) return; //查看路径中后缀为. ...

  10. 理解 Redis(9) - Publish Subscribe 消息订阅

    在窗口1开通一个名为 redis 的通道: 127.0.0.1:6379> SUBSCRIBE redis Reading messages... (press Ctrl-C to quit) ...