# SSH Connection error

**URL:** <https://community.jenkins.io/t/ssh-connection-error/6148>\
**Category:** Using Jenkins\
**Created:** [March 8, 2023, 8:48am UTC](https://community.jenkins.io/t/ssh-connection-error/6148 "2023-03-08T08:48:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 8, 2023, 8:48am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/1 "2023-03-08T08:48:23Z")

</div>

Hi team Facing below error while configuring SSH  
Failed to connect or change directory

jenkins.plugins.publish\_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [10\_226\_110\_118\_Prod]. Message [Session.connect: java.net.SocketException: Connection reset]]

Can i know the reason

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [March 8, 2023, 2:47pm UTC](https://community.jenkins.io/t/ssh-connection-error/6148/2 "2023-03-08T14:47:22Z")

</div>

Connection reset usually means there is some network error or your configuration is incorrect. Are you sure the system name is correct, the username/password are correct, etc. Connection reset means that there was a TCP RST packet sent, so something is off in your setup most likely. Without more information about your setup, it will be very difficult to help.

---

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 15, 2023, 4:08am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/3 "2023-03-15T04:08:31Z")

</div>

Hi  
We are using username / password for connection.Source and destination server are AWS and telent is working fine on port 22.  
Can you please share any steps required to configure at destination end if we are using Username and password.

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [March 15, 2023, 7:16am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/4 "2023-03-15T07:16:08Z")

</div>

Hello @tharun456 ,

`telnet` on port `22`? What about `ssh`?

---

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 15, 2023, 7:17am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/5 "2023-03-15T07:17:43Z")

</div>

Hi  
Port 22 is for SSH connection right?

---

<div class="post-metadata">

**Author:** ![poddingue](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/poddingue/32/985_2.png) [@poddingue](https://community.jenkins.io/u/poddingue)\
**Post date:** [March 15, 2023, 7:18am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/6 "2023-03-15T07:18:25Z")

</div>

As far as I know, yes, that’s the port we usually use for `ssh` and not telnet.

---

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 15, 2023, 7:39am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/7 "2023-03-15T07:39:31Z")

</div>

for checking connection from jenkins server to destination server on port 22 .i have done telent its working fine but. getting below error in console while checking connection.

jenkins.plugins.publish\_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [10\_226\_110\_118\_Prod]. Message [Session.connect: java.net.SocketException: Connection reset]]

---

<div class="post-metadata">

**Author:** ![slide\_o\_mix](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/slide_o_mix/32/20977_2.png) [@slide\_o\_mix](https://community.jenkins.io/u/slide_o_mix)\
**Post date:** [March 15, 2023, 1:41pm UTC](https://community.jenkins.io/t/ssh-connection-error/6148/8 "2023-03-15T13:41:21Z")

</div>

When you say telnet is working fine to port 22, what do you mean? You are able to connect, or something else?

---

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 16, 2023, 5:28am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/9 "2023-03-16T05:28:37Z")

</div>

Hi getting below error.

C:\Users\XXXXX\>ssh xxxxx\bsgauth@10.xx.xxx.xxx  
Connection reset by 10.xx.xx.xx port 22

please help why connection reset is occuring .is issue with jenkins or destination server

---

<div class="post-metadata">

**Author:** ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)\
**Post date:** [March 16, 2023, 7:54am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/10 "2023-03-16T07:54:11Z")

</div>

If you can’t ssh outside of jenkins, then it’s not a jenkins issue.

Use ssh -v to enable more debugging. Check server logs and firewalls. Talk to your ops team. Google “how to debug ssh connection reset”. Etc

---

<div class="post-metadata">

**Author:** ![tharun456](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@tharun456](https://community.jenkins.io/u/tharun456)\
**Post date:** [March 23, 2023, 7:06am UTC](https://community.jenkins.io/t/ssh-connection-error/6148/11 "2023-03-23T07:06:23Z")

</div>

Hi Team  
Thanks for your assistance.After reinstalling SSH on server .I can able to connect.
