(转) 解决ssh的"Write failed: Broken pipe"问题

解决ssh的"Write failed: Broken pipe"问题

 

问题场景

服务器环境:阿里云 Linux CentOS 主机

客户端:Mac OSX Terminal

问题现象

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

Write failed: Broken pipe

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

解决方法

方法一:如果您有多台服务器,不想在每台服务器上设置,只需在客户端的 ~/.ssh/ 文件夹中添加 config 文件,并添加下面的配置:

ServerAliveInterval 60

方法二:如果您有多个人管理服务器,不想在每个客户端进行设置,只需在服务器的 /etc/ssh/sshd_config 中添加如下的配置:

ClientAliveInterval 60

方法三:如果您只想让当前的 ssh 保持连接,可以使用以下的命令:

$ ssh -o ServerAliveInterval=60 user@sshserver

方法来源

Ssh “Write failed: Broken pipe”

 

 

时间: 2024-07-28 14:50:44

(转) 解决ssh的"Write failed: Broken pipe"问题的相关文章

Python提示[Errno 32]Broken pipe导致线程crash错误解决方法_python

本文实例讲述了Python提示[Errno 32]Broken pipe导致线程crash错误解决方法.分享给大家供大家参考.具体方法如下: 1. 错误现象ThreadingHTTPServer 实现的 http 服务,如果客户端在服务器返回前,主动断开连接,则服务器端会报 [Errno 32] Broken pipe 错,并导致处理线程 crash. 下面先看个例子,python 版本: 2.7 示例代码 复制代码 代码如下: #!/usr/bin/env python #!coding=ut

[android]MonkeyRunner“java.net.SocketException: Broken pipe”错误解决办法

from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice import time import random d=MonkeyRunner.waitForConnection() d.wake() for i in range(0,100): #TOUCH|{'x':55,'y':795,'type':'downAndUp',} d.startActivity(action='android.intent.action.MAIN

【故障|监听】TNS-12518、TNS-00517和 Linux Error:32:Broken pipe

[故障|监听]TNS-12518.TNS-00517和 Linux Error:32:Broken pipe 1.1  BLOG文档结构图     1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~: ① Linux Error: 32: Broken pipe的可能原因(重点) ② TNS-12518: TNS:listener could not hand off client conne

What makes a Unix process die with Broken pipe?

What makes a Unix process die with Broken pipe? up vote6down votefavorite Here are some options I thought of, not sure which is the right one. a) There was an I/O error reading from the pipe. b) The process writing to the other end of the pipe died w

Python提示[Errno 32] Broken pipe 导致线程crash错误

1       错误现象 ThreadingHTTPServer 实现的 http 服务,如果客户端在服务器返回前,主动断开连接,则服务器端会报 [Errno 32] Broken pipe 错,并导致处理线程 crash. 下面先看个例子,python 版本: 2.7 示例代码  代码如下 复制代码 #!/usr/bin/env python #!coding=utf-8   import os import time import socket import threading from B

TNS-12518 & Linux Error:32:Broken pipe

最近一周,有一台ORACLE数据库服务器的监听服务在凌晨2点过几分的时间点突然崩溃,以前从没有出现过此类情况,但是最近一周出现了两次这种情况,检查时发现了如下一些信息: $ lsnrctl services   LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 12-DEC-2014 08:22:34   Copyright (c) 1991, 2007, Oracle.  All rights reserved.   Connectin

Linux系统引起java.net.SocketException: Broken pipe的原因?

问题描述 有两台linux服务器A.B系统版本都是 Red Hat Enterprise Linux Server release 6.0 (Santiago)JDK版本都是 1.6.0_29在A端发布一个RMI服务,配置如下<bean id="rmiServerHost" factory-method="setProperty" class="java.lang.System" lazy-init="false">

大神速度解决-SSH 启动出错 [unknown location]

问题描述 SSH 启动出错 [unknown location] 我用的注解Unable to load configuration. - [unknown location] at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) a

解决ssh暴力破解服务器密码

自从开通了阿里云态势感知后,经常收到提醒,你的服务器被攻击,我从后台查看大多数攻击都是ssh暴力破解密码,于是我就考虑如何解决这一问题,一开始想到的是,修改端口,接着就是封ip地址.那下边就看看我是如何操作的, 一.修改ssh默认端口(我是修改成2222) 1.首先如果有防火墙脚本需要将2222端口添加进去,允许通过2222端口访问服务器. 2编辑ssh/sshd_config vim /etc/ssh/sshd_config 在#Port 22下边添加 Port 2222 退出保存 3.重启s