首页 > 其他分享 >如何修复 SSH Client_loop: send disconnect: Broken pipe Error

如何修复 SSH Client_loop: send disconnect: Broken pipe Error

时间:2023-06-07 22:23:27浏览次数:47  
标签:disconnect send Broken Client SSH 客户端

动动发财的小手,点个赞吧!

SSH 是 Secure Shell 的缩写,是一种远程网络协议,用于通过 TCP/IP 网络安全地连接到远程设备,例如服务器和网络设备。

它是一种加密网络协议,可提供强大的加密技术和散列法来保护网络上两个设备之间的通信。

SSH使用两种主要的认证方式:密码认证和公钥认证。使用密码验证时,用户提供远程主机的 IP 地址或 FQDN(完全限定域名)和密码进行验证。

公钥认证使用SSH 密钥对进行认证,SSH 密钥对由两个SSH 密钥组成:私钥和公钥。

私钥驻留在用户的机器上,应始终保密和安全。公钥保存在用户连接的远程主机上。在身份验证期间,比较两个密钥的身份并授予访问权限。

通过 SSH 连接到远程系统时,您可能会遇到错误 Client_loop: send disconnect: Broken pipe。

本教程中,我们将了解为什么会发生这种情况并解决错误。

Client_loop: send disconnect: Broken pipe 错误

该错误只是一条断开连接消息,通知您已超过 SSH 连接超时。

这是一个不活动的时期,在此期间没有从客户端执行或发出任何 Linux 命令。发生这种情况时,SSH 会话将终止,从而有效地断开您与远程服务器的连接。

大多数用户通常会按“ENTER”或键盘上的某个键,以避免空闲 SSH 会话导致与主机断开连接。然而,这可能是乏味且浪费时间的。

值得庆幸的是,SSH 默认配置设置提供了一些参数,您可以配置这些参数以使 SSH 连接保持活动状态更长的时间。

修复 Client_loop: send disconnect: Broken pipe 错误

要解决此问题,您需要增加客户端上的 SSH 连接超时时间。为此,请修改通常位于 /etc/ssh/sshd_config 的默认 SSH 配置文件。

sudo vi /etc/ssh/sshd_config

请务必找到这两个参数:ClientAliveInterval 和 ClientAliveCountMax。让我们看看他们做了什么。

  • ClientAliveInterval——这是一段不活动的时间,在此之后 SSH 服务器向连接到它的远程客户端发送一条活动消息。

  • ClientAliveCountMax – 这是服务器尝试将活动消息从服务器发送到客户端的次数。

我们将这两个值设置如下:

ClientAliveInterval	300
ClientAliveCountMax	3

这意味着在客户端不活动的前 300 秒(5 分钟)之后,服务器将向客户端发送一条活动消息以保持 SSH 会话处于活动状态。

如果在接下来的 300 秒内(在 600 秒标记处)没有从客户端收到任何数据或响应,服务器将再次发送另一条活动消息。最后,在客户端不活动 900 秒后,SSH 连接将终止或断开。

请务必保存对文件所做的更改,然后退出。然后重新启动 SSH 守护程序。

sudo systemctl restart sshd

或者,您可以通过以秒(300 秒)为单位指定 ServerAliveInterval 参数来连接到您的远程客户端 Linux 系统,这意味着您的 SSH 会话处于活动状态最多 5 分钟。

ssh -o ServerAliveInterval=300 username@server_ip_address

在本教程中,我们演示了如何解决 Client_loop: send disconnect: Broken pipe 错误。如您所见,您只需在 SSH 配置文件中执行一些调整。

本文由mdnice多平台发布

标签:disconnect,send,Broken,Client,SSH,客户端
From: https://www.cnblogs.com/swindler/p/17464754.html

相关文章

  • ARN [main-SendThread(db99:2222)] zookeeper.ClientCnxn: Session 0x0 for server n
    1.2014-07-2117:24:36,310WARN [main-SendThread(db99:2222)]zookeeper.ClientCnxn:Session0x0forservernull,unexpectederror,closingsocketconnectionandattemptingreconnectjava.net.ConnectException:拒绝连接     ......
  • shell命令:getevent和sendevent
    1.getevent输出所有event设备的基本信息 输出格式:设备名:事件type事件code事件value注意:这里的数字都是16进制。getevent-c10//输出10条信息后退出getevent-l//将type、code、value以对应的常量名称显示使用getevent-l命令后输出结果格式为:  对应的数字代码转......
  • QA|selenium在send_keys时报错dict object has no attribute ''|UI自动化测试
    Q:selenium在send_keys时报错dictobjecthasnoattribute'send_keys',如下图 增加了print(type(e1))发现确实是字典类型,怪了,按道理e1的type应该是selenium.webdriver.remote.webelement.WebElement才对,怎么会变成dict字典呢?我网上查了,按照(115条消息)Python运行selenium时......
  • Python协程:从yield/send到yield from再到async/await
    Python中的协程大概经历了如下三个阶段:最初的生成器变形yield/send引入@asyncio.coroutine和yieldfrom在最近的Python3.5版本中引入async/await关键字一、生成器变形yield/send普通函数如果出现了yield关键字,那么该函数就不再是普通函数,而是一个生成器。importrandom......
  • nginx 配置中的sendfile 的作用
    http{...sendfileon...}sendfile配置的具体意思:设置为on表示,使用零拷贝技术来传输文件:sendfile,这样只需要2次上下文切换,和2次数据拷贝。设置为off表示,使用传统的文件传输技术:read+write,这时就需要4次上下文切换,和4次数据拷贝。当然,要使用sendfil......
  • servJump extends HttpServlet //request.getRequestDispatcher //response.sendRed
    packagecom.test;importjava.io.IOException;importjava.io.PrintWriter;importjava.util.HashMap;importjava.util.Map;importjavax.servlet.ServletException;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;impo......
  • openwrt ping: sendto: Network unreachable解决办法
    root@OpenWrt:/#pingzhihu.comPINGzhihu.com(103.41.167.234):56databytesping:sendto:Networkunreachable这个错误一般是由于网关配置错误导致的通过 route 查看路由表root@OpenWrt:/#routeKernelIProutingtableDestinationGatewayGenm......
  • aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    #解决:#1.aiohttp.TCPConnector(limit=0)=>aiohttp.TCPConnector(limit=10)#2.添加timeout=aiohttp.ClientTimeout(total=600)asyncdefget_data_main():#初始化数据库#db_utils.init_db('auto_search_uat.db')set_logging.set_get_data_log(......
  • 【问题解决】Kafka报错 Bootstrap broker x.x.x.x:9092 (id: -1 rack: null) disconne
    问题复现近日针对某一客户需求开发了一个需要使用Kafka的功能,功能是什么暂且不论,在本地虚机的Kafka连接一切正常遂放到测试服务器上验证功能,以下是监听topic成功和警告报错:2023-05-0910:22:23[localhost-startStop-1]INFOorg.apache.kafka.clients.consumer.ConsumerConfig......
  • WARNING: Running pip as the 'root' user can result in broken permissions and con
      pipinstall-rrequirements.txt报错"WARNING:Runningpipasthe'root'usercanresultinbrokenpermissionsandconflictingbehaviourwiththesystempackagemanager.Itisrecommendedtouseavirtualenvironmentinstead:https://pip.pyp......