SSH Connection [AUTH FAIL]

Hi Team
Recently an domain migration has happened.It changed from x to y.
When i try to check ssh connection getting auth fail.Error is pasted below
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [badlavserverUAT]. Message [Auth fail]].
Note: Telnet is able to reach from jenkins server to destination server.
2.ssh is configured using username and passoword.

Please help with any solution .Thanks

Hello Tharun,

Does the ssh connection work from a terminal?

Getting this error ssh -p 22 user@host
Permission denied (publickey,keyboard-interactive).

Are you using a key to log in (I guess so)?
Could you try to specify the key to use in order to login?
Something like:

ssh -i deployment_key.txt -p 22 user@host

I would recommend looking at the logs of the ssh server to see why it’s failing.

Same issue.

SSH connect work from terminal but Jenkins can’t connect

  • there are 2 containers in docker compose:
    • jenkins
    • remote_host
  • there are 2 keys:
    • id_rsa3
    • id_rsa3.pub
  • when connect to jenkins container via:
    • docker exec -it jenkins bash
      and try:
    • ssh -i id_rsa3 a12@remote_host → it can connect without password
  • but when I configure same Jenkins SSH with this id_rsa3:
    • Can’t connect to server

SSH was generate by: ssh-keygen -t rsa -m PEM -f id_rsa3
LOGS from Jenkins show → Auth fail and Can’t connect to server

would still recommend looking at the sshd logs on the target server. They’ll tell you a lot about why a login request was rejected. Its likely you pasted the wrong ssh keys into credentials

1 Like

True. This advide was very helpfull. When I check remote_host logs I saw: “key type ssh-rsa not in PubkeyAcceptedAlgorithms”. After I create ssh-key in this way: ssh-keygen -t ecdsa -m PEM -f id_rsa3 - connect started working.
Looks like the issue was related to this topic: Ubuntu 22.04 SSH the RSA key isn’t working since upgrading from 20.04.