# Connection reset by peer

How can I fix "kex\_exchange\_identification: read: Connection reset by peer"?

**The error is:**

```
kex_exchange_identification: read: Connection reset by peer
Connection reset by x.x.x.x port 22
Connection closed by x.x.x.x port 34976
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FE54oFFNNSMd9w0v7M6MO%2Fimage.png?alt=media&#x26;token=6096aa96-9ba9-4046-86a9-6ecca924ffae" alt=""><figcaption></figcaption></figure>

It could be the process on the server side listening to the SSH *port* is dead, and even a restart / stop service do not work. So to find the process, and killing it may solve the problem.

Let's debug more with netstat:&#x20;

```
sudo netstat -ntlp
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2Fjmy8IiYdfxt1dLevWZXV%2Fimage.png?alt=media&#x26;token=691d76cf-cbb9-41b1-8238-0858e2f7f64e" alt=""><figcaption></figcaption></figure>

Time to kill pid:

```
sudo kill 619
sudo netstat -ntlp
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FpuT6pcV4Ojs5sU9surdf%2Fimage.png?alt=media&#x26;token=27fcfcc6-3ac8-420d-a5a8-ea024ae86511" alt=""><figcaption></figcaption></figure>

Now, the issue is fixed:&#x20;

```bash
sudo systemctl restart ssh
sudo systemctl status ssh
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2F7z6dDf8ruegl1r8fp4g5%2Fimage.png?alt=media&#x26;token=c38c0a87-c658-449c-918c-3fec4707b713" alt=""><figcaption></figcaption></figure>
