如何修复“kex_exchange_identification:读取:对等方重置连接”?

2024-01-07

我想复制数据scp在使用 PRIVATE_KEY 的 GitLab 管道中。

错误是:

kex_exchange_identification: read: Connection reset by peer
Connection reset by x.x.x.x port 22
lost connection

管道日志:

$ mkdir -p ~/.ssh

$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa

$ chmod 600 ~/.ssh/id_rsa

$ eval "$(ssh-agent -s)"
Agent pid 22

$ ssh-add ~/.ssh/id_rsa
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

$ ssh-keyscan -H $IP >> ~/.ssh/known_hosts
# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10

$ scp -rv api.yml root@$IP:/home/services/test/

Executing: program /usr/bin/ssh host x.x.x.x, user root, command scp -v -r -t /home/services/test/

OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
kex_exchange_identification: read: Connection reset by peer
Connection reset by x.x.x.x port 22
lost connection

kex_exchange_identification: read: Connection reset by peer

当 SSH 客户端连接到 SSH 服务器时,服务器首先向客户端发送版本字符串。您收到的错误意味着,当客户端等待来自服务器的数据时,即 TCP 连接打开后,从客户端到服务器的 TCP 连接“异常关闭”。

实际上,它可能意味着以下两件事之一:

  1. SSH 服务器进程出现故障(崩溃),或者可能检测到一些严重问题导致其立即退出。
  2. 某些防火墙正在干扰与 ssh 服务器的连接。

它看起来像ssh 密钥扫描程序能够连接到服务器并获取版本字符串,没有错误。因此,SSH 服务器进程显然能够与客户端通信而不会崩溃。

您应该与该 x.x.x.x 主机及其所连接的网络的管理员联系,看看他们是否可以从他们的一端识别出问题。有可能某些东西(防火墙或 ssh 服务器进程本身)首先从ssh 密钥扫描过程,然后由scp程序,作为入侵尝试。它阻止了第二次连接尝试。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何修复“kex_exchange_identification:读取:对等方重置连接”? 的相关文章

  • 如何从远程 ssh 连接上运行的 tmux(复制模式)复制到本地剪贴板

    我通过 OS X 上的 VirtualBox 运行 Linux 我通过在无头状态下运行虚拟机 然后使用端口转发 sshing 到 Linux 机器来实现这一点 现在 无论复制到我的虚拟机上的剪贴板 我都可以粘贴到我的远程 ssh 会话上 但
  • 为管道重用自定义对象时出现意外结果

    A while ago I changed my Join Object https stackoverflow com a 45483110 1701026 cmdlet which appeared to cause a bug whi
  • 在防火墙后面使用 GitHub,无需 SSH 访问

    我真的很想使用 GitHub 但我的公司一切都被锁定了 现在 我只能通过HTTP协议使用Tortoise SVN 我可以以同样的方式使用 GitHub 吗 如果是这样 怎么办 我认为你一直能够克隆github https github co
  • GridGain - 通过 Grid.startNodes API 使用 SSH 以编程方式打开节点

    我正在使用 Grid startNodes java util Collection java util Map boolean int int 如此处定义 http gridgain com api javadoc org gridgai
  • 抑制数组列表添加方法管道输出

    我正在使用数组列表来构建日志项序列以供稍后记录 工作起来很不错 但是 Add 方法将当前索引发送到管道 我可以通过将其发送到 null 来解决这个问题 如下所示 strings Add junk gt null 但我想知道是否有某种机制可以
  • 使用 JSch 分别为各个提示提供输入

    问题是 SSH 连接需要在常规登录后提供另一个用户 ID 和密码信息 我正在使用 JSch 连接到远程服务器 它接受以下形式的输入InputStream 和这个InputStream只能通过一次 由于会话是交互式的 这会导致问题 我尝试将输
  • SVN 不断提示我输入密码并拒绝缓存我的凭据

    环境 Eclipse Indigo Ubuntu 11 04 Subclipse 1 6 SVN 客户端 Subclipse RabbitVCS 我通过 svn ssh 连接 我的网址如下所示 svn ssh 我的名字 我的域名 路径 我可
  • 未创建 .ssh 目录

    生成 sshdir 我使用这个命令 ssh keygen 摘自本教程 http ebiquity umbc edu Tutorials Hadoop 05 20 20Setup 20SSHD html http ebiquity umbc
  • Renci ssh.net - 连接时从表单创建控制台屏幕

    我想创建 我认为它是一个控制台 屏幕来输入并在 renci ssh net 连接之后 或期间 查看输出 我目前有一个 form1 它收集连接信息 然后您按下按钮通过 backgroundworker1 进行连接 我想我需要一个 form2
  • Bash - 转义 SSH 命令

    我有一组脚本 用于通过 FTP 下载文件 然后从服务器中删除它们 其工作原理如下 for dir in ls volume1 auto downloads sync complete do if x dir x then echo DIR
  • Gitlab Ci 无法从运行器推送分支

    我正在尝试使用 Gitlab 设置 CI CD 管道 这是我想做的 注意 这是一个打字稿项目 单元测试和集成测试 促进分支开发到分支集成 从分支集成构建 docker 镜像 部署到集成环境 这里是 gitlab ci yml我正在使用 我
  • seq 使用逗号作为小数点分隔符

    我注意到一个奇怪的现象seq我的一台计算机 Ubuntu LTS 14 04 上的行为 不是使用点作为小数点分隔符 而是使用逗号 seq 0 0 1 0 2 0 0 0 1 0 2 我的另一台 PC 上相同版本的 seq 8 21 给出了正
  • ssh - 控制套接字不存在 - 操作超时

    当我尝试从 Mac 上通过 SSH 连接到远程桌面时 收到以下错误消息 ssh vvvv email protected cdn cgi l email protection OpenSSH 7 4p1 LibreSSL 2 5 0 deb
  • SmartGIT 不要求 ssh 密钥

    切换到新计算机后 我必须再次安装 Windows 版 SmartGIT 现在尝试克隆我的 fedorahosted org repository 密钥存储在 C User myusername ssh SmartGIT 附带了全新安装 并且
  • php run git 收到“ssh 权限被拒绝”

    我正在尝试从浏览器中运行 git pull php 脚本 但我得到了 sh 连接到主机 git assembla com 端口 22 权限被拒绝 我的 PHP 脚本
  • 如何在同一实例中运行 Gitlab CI 作业

    我已经自动缩放了 gitlab runnerAWS现货实例 而且效果很好 我在运行作业时遇到问题 下面是我的 gitlab ci yml它有两个阶段 stages build dev1 build build stage build scr
  • 是否可以让 Capistrano 通过反向 SSH 隧道进行结帐?

    我正在开发一个驻留在公共主机上的应用程序 但我必须将其源代码保存在公司防火墙后面的 Git 存储库中 我越来越very厌倦了通过缓慢的部署scp 复制整个存储库并在每次部署时通过 SSH 传送 并且希望远程主机只需执行git pull更新
  • SSH IdentitiesOnly=yes 转发我的所有密钥

    我一生都无法弄清楚为什么我的 SSH 配置转发了错误的密钥 我有两把钥匙 我们会打电话给他们home rsa and work rsa 我做了以下事情 eval ssh agent ssh add K ssh home rsa ssh ad
  • 如何为 VS Code SSH Remote 配置不同的 shell?

    当我连接到 VS Code 集成终端时 如何更改使用的 shell远程 ssh 工作区 https code visualstudio com docs remote ssh 添加 Matt Bierner 的答案 较新的版本vscode现
  • 在centos上设置jenkins:ssh密钥和git的问题

    经历了很多问题 但似乎没有什么能解决我的问题 或者更准确地说 我不确定我是否正确地完成了整个事情 所以这里是 已安装centos 6 3操作系统 然后我按照以下指南安装詹金斯 https wiki jenkins ci org displa

随机推荐