kandi background
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
kandi background
Explore Kits
Explore all Ubuntu open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Ubuntu

7.1.0

focal-1.0.0

14.9.2

Continuous build

Squirrel.Windows 2.0.1

neofetch

7.1.0

baseimage-docker

focal-1.0.0

docker-gitlab

14.9.2

AppImageKit

Continuous build

Squirrel.Windows

Squirrel.Windows 2.0.1

Popular Libraries in Ubuntu

Trending New libraries in Ubuntu

Top Authors in Ubuntu

1

29 Libraries

75

2

25 Libraries

540

3

20 Libraries

5776

4

16 Libraries

592

5

15 Libraries

971

6

14 Libraries

137

7

14 Libraries

612

8

14 Libraries

144

9

14 Libraries

224

10

13 Libraries

45

1

29 Libraries

75

2

25 Libraries

540

3

20 Libraries

5776

4

16 Libraries

592

5

15 Libraries

971

6

14 Libraries

137

7

14 Libraries

612

8

14 Libraries

144

9

14 Libraries

224

10

13 Libraries

45

Trending Kits in Ubuntu

No Trending Kits are available at this moment for Ubuntu

Trending Discussions on Ubuntu

    How to fix? "kex_exchange_identification: read: Connection reset by peer"
    Error: require() of ES modules is not supported when importing node-fetch
    NPM install task failing in Azure Devops, same code worked previously
    Github Actions Failing
    WARNING: Running pip as the 'root' user
    How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?
    How can I install kubectx on Ubuntu Linux 20.04?
    MySQL Workbench SSL connection error: SSL is required but the server doesn't support it
    Rails bundle install Could not find turbo-rails-7.1.1 in any of the sources
    Flutter Web: Cannot scroll with mouse down (drag) (Flutter 2.5+)

QUESTION

How to fix? "kex_exchange_identification: read: Connection reset by peer"

Asked 2022-Mar-30 at 10:07

I want to copy data with scp in GitLab pipeline using PRIVATE_KEY error is :

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4

pipeline log:

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4$ mkdir -p ~/.ssh
5$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
6$ chmod 600 ~/.ssh/id_rsa
7$ eval "$(ssh-agent -s)"
8Agent pid 22
9
10$ ssh-add ~/.ssh/id_rsa
11Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
12
13$ ssh-keyscan -H $IP >> ~/.ssh/known_hosts
14# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
15# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
16
17$ scp -rv api.yml root@$IP:/home/services/test/
18Executing: program /usr/bin/ssh host x.x.x.x, user root, command scp -v -r -t /home/services/test/
19
20OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021
21debug1: Reading configuration data /etc/ssh/ssh_config
22debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
23debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
24debug1: Connection established.
25debug1: identity file /root/.ssh/id_rsa type -1
26debug1: identity file /root/.ssh/id_rsa-cert type -1
27debug1: identity file /root/.ssh/id_dsa type -1
28debug1: identity file /root/.ssh/id_dsa-cert type -1
29debug1: identity file /root/.ssh/id_ecdsa type -1
30debug1: identity file /root/.ssh/id_ecdsa-cert type -1
31debug1: identity file /root/.ssh/id_ecdsa_sk type -1
32debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
33debug1: identity file /root/.ssh/id_ed25519 type -1
34debug1: identity file /root/.ssh/id_ed25519-cert type -1
35debug1: identity file /root/.ssh/id_ed25519_sk type -1
36debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
37debug1: identity file /root/.ssh/id_xmss type -1
38debug1: identity file /root/.ssh/id_xmss-cert type -1
39debug1: Local version string SSH-2.0-OpenSSH_8.6
40kex_exchange_identification: read: Connection reset by peer
41Connection reset by x.x.x.x port 22
42lost connection
43

ANSWER

Answered 2021-Sep-30 at 19:40

copy icondownload icon

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4$ mkdir -p ~/.ssh
5$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
6$ chmod 600 ~/.ssh/id_rsa
7$ eval "$(ssh-agent -s)"
8Agent pid 22
9
10$ ssh-add ~/.ssh/id_rsa
11Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
12
13$ ssh-keyscan -H $IP >> ~/.ssh/known_hosts
14# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
15# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
16
17$ scp -rv api.yml root@$IP:/home/services/test/
18Executing: program /usr/bin/ssh host x.x.x.x, user root, command scp -v -r -t /home/services/test/
19
20OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021
21debug1: Reading configuration data /etc/ssh/ssh_config
22debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
23debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
24debug1: Connection established.
25debug1: identity file /root/.ssh/id_rsa type -1
26debug1: identity file /root/.ssh/id_rsa-cert type -1
27debug1: identity file /root/.ssh/id_dsa type -1
28debug1: identity file /root/.ssh/id_dsa-cert type -1
29debug1: identity file /root/.ssh/id_ecdsa type -1
30debug1: identity file /root/.ssh/id_ecdsa-cert type -1
31debug1: identity file /root/.ssh/id_ecdsa_sk type -1
32debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
33debug1: identity file /root/.ssh/id_ed25519 type -1
34debug1: identity file /root/.ssh/id_ed25519-cert type -1
35debug1: identity file /root/.ssh/id_ed25519_sk type -1
36debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
37debug1: identity file /root/.ssh/id_xmss type -1
38debug1: identity file /root/.ssh/id_xmss-cert type -1
39debug1: Local version string SSH-2.0-OpenSSH_8.6
40kex_exchange_identification: read: Connection reset by peer
41Connection reset by x.x.x.x port 22
42lost connection
43kex_exchange_identification: read: Connection reset by peer
44

When an ssh client connects to an ssh server, the server starts by sending a version string to the client. The error that you're getting means that the TCP connection from the client to the server was "abnormally closed" while the client was waiting for this data from the server, in other words immediately after the TCP connection was opened.

As a practical matter, it's likely to mean one of two things:

  1. The ssh server process malfunctioned (crashed), or perhaps it detected some serious issue causing it to exit immediately.
  2. Some firewall is interfering with connections to the ssh server.

It looks like the ssh-keyscan program was able to connect to the server and get a version string without an error. So the ssh server process is apparently able to talk to a client without crashing.

You should talk the administrators of this x.x.x.x host and the network that it's attached to, to see if they can identify the problem from their end. It's possible that something--a firewall, or the ssh server process itself--is seeing the multiple connections, first from the ssh-keyscan process, then by the scp program, as an intrusion attempt. And it's blocking the second connection attempt.

Source https://stackoverflow.com/questions/69394001

Community Discussions contain sources that include Stack Exchange Network

    How to fix? "kex_exchange_identification: read: Connection reset by peer"
    Error: require() of ES modules is not supported when importing node-fetch
    NPM install task failing in Azure Devops, same code worked previously
    Github Actions Failing
    WARNING: Running pip as the 'root' user
    How to open emulators in different windows at Android Studio (Bumblebee | 2021.1.1)?
    How can I install kubectx on Ubuntu Linux 20.04?
    MySQL Workbench SSL connection error: SSL is required but the server doesn't support it
    Rails bundle install Could not find turbo-rails-7.1.1 in any of the sources
    Flutter Web: Cannot scroll with mouse down (drag) (Flutter 2.5+)

QUESTION

How to fix? "kex_exchange_identification: read: Connection reset by peer"

Asked 2022-Mar-30 at 10:07

I want to copy data with scp in GitLab pipeline using PRIVATE_KEY error is :

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4

pipeline log:

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4$ mkdir -p ~/.ssh
5$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
6$ chmod 600 ~/.ssh/id_rsa
7$ eval "$(ssh-agent -s)"
8Agent pid 22
9
10$ ssh-add ~/.ssh/id_rsa
11Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
12
13$ ssh-keyscan -H $IP >> ~/.ssh/known_hosts
14# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
15# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
16
17$ scp -rv api.yml root@$IP:/home/services/test/
18Executing: program /usr/bin/ssh host x.x.x.x, user root, command scp -v -r -t /home/services/test/
19
20OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021
21debug1: Reading configuration data /etc/ssh/ssh_config
22debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
23debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
24debug1: Connection established.
25debug1: identity file /root/.ssh/id_rsa type -1
26debug1: identity file /root/.ssh/id_rsa-cert type -1
27debug1: identity file /root/.ssh/id_dsa type -1
28debug1: identity file /root/.ssh/id_dsa-cert type -1
29debug1: identity file /root/.ssh/id_ecdsa type -1
30debug1: identity file /root/.ssh/id_ecdsa-cert type -1
31debug1: identity file /root/.ssh/id_ecdsa_sk type -1
32debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
33debug1: identity file /root/.ssh/id_ed25519 type -1
34debug1: identity file /root/.ssh/id_ed25519-cert type -1
35debug1: identity file /root/.ssh/id_ed25519_sk type -1
36debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
37debug1: identity file /root/.ssh/id_xmss type -1
38debug1: identity file /root/.ssh/id_xmss-cert type -1
39debug1: Local version string SSH-2.0-OpenSSH_8.6
40kex_exchange_identification: read: Connection reset by peer
41Connection reset by x.x.x.x port 22
42lost connection
43

ANSWER

Answered 2021-Sep-30 at 19:40

copy icondownload icon

1kex_exchange_identification: read: Connection reset by peer
2Connection reset by x.x.x.x port 22
3lost connection
4$ mkdir -p ~/.ssh
5$ echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
6$ chmod 600 ~/.ssh/id_rsa
7$ eval "$(ssh-agent -s)"
8Agent pid 22
9
10$ ssh-add ~/.ssh/id_rsa
11Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
12
13$ ssh-keyscan -H $IP >> ~/.ssh/known_hosts
14# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
15# x.x.x.x:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
16
17$ scp -rv api.yml root@$IP:/home/services/test/
18Executing: program /usr/bin/ssh host x.x.x.x, user root, command scp -v -r -t /home/services/test/
19
20OpenSSH_8.6p1, OpenSSL 1.1.1l  24 Aug 2021
21debug1: Reading configuration data /etc/ssh/ssh_config
22debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
23debug1: Connecting to x.x.x.x [x.x.x.x] port 22.
24debug1: Connection established.
25debug1: identity file /root/.ssh/id_rsa type -1
26debug1: identity file /root/.ssh/id_rsa-cert type -1
27debug1: identity file /root/.ssh/id_dsa type -1
28debug1: identity file /root/.ssh/id_dsa-cert type -1
29debug1: identity file /root/.ssh/id_ecdsa type -1
30debug1: identity file /root/.ssh/id_ecdsa-cert type -1
31debug1: identity file /root/.ssh/id_ecdsa_sk type -1
32debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
33debug1: identity file /root/.ssh/id_ed25519 type -1
34debug1: identity file /root/.ssh/id_ed25519-cert type -1
35debug1: identity file /root/.ssh/id_ed25519_sk type -1
36debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
37debug1: identity file /root/.ssh/id_xmss type -1
38debug1: identity file /root/.ssh/id_xmss-cert type -1
39debug1: Local version string SSH-2.0-OpenSSH_8.6
40kex_exchange_identification: read: Connection reset by peer
41Connection reset by x.x.x.x port 22
42lost connection
43kex_exchange_identification: read: Connection reset by peer
44

When an ssh client connects to an ssh server, the server starts by sending a version string to the client. The error that you're getting means that the TCP connection from the client to the server was "abnormally closed" while the client was waiting for this data from the server, in other words immediately after the TCP connection was opened.

As a practical matter, it's likely to mean one of two things:

  1. The ssh server process malfunctioned (crashed), or perhaps it detected some serious issue causing it to exit immediately.
  2. Some firewall is interfering with connections to the ssh server.

It looks like the ssh-keyscan program was able to connect to the server and get a version string without an error. So the ssh server process is apparently able to talk to a client without crashing.

You should talk the administrators of this x.x.x.x host and the network that it's attached to, to see if they can identify the problem from their end. It's possible that something--a firewall, or the ssh server process itself--is seeing the multiple connections, first from the ssh-keyscan process, then by the scp program, as an intrusion attempt. And it's blocking the second connection attempt.

Source https://stackoverflow.com/questions/69394001

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Ubuntu

Tutorials and Learning Resources are not available at this moment for Ubuntu

Share this Page

share link

Get latest updates on Ubuntu

  • © 2022 Open Weaver Inc.
  • © 2022 Open Weaver Inc.