Not able to deploy to new server with ssh publish, getting error

Hi Team

Trying to deploy code to new server with ssh, getting below error when i test the connection to remote server.

jenkins.plugins.publish_over.BapPublisherException: Failed to add SSH key. Message [invalid privatekey: [B@2d272efe]

In jennkins console log, i see below error:

SSH: Connecting from host [jenkins-server]
SSH: Connecting with configuration [remote server name] ...
SSH: Creating session: username [remote user], hostname [remote server], port [22]
SSH: Connecting session ...
ERROR: Exception when publishing, exception message [Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [remote server name]. Message [Auth fail]]]
[Pipeline] sshPublisher
SSH: Current build result is [FAILURE], not going to run.

copied jenkins pub key to remote server.
Anybody can give me steps on how and what to do to deploy code to new server?

Jenkins is able to deploy to other already added existing servers.

Thanks and appreciate your help on this.

Hi @devops1 ,

Can you log thanks to ssh from the Jenkins machine to the target machine?
Did you use the ssh-copy-id command?

1 Like

Hi @poddingue
Yes, i can login thro ssh from Jenkins to target machine.
manually copied public key from jenkins to target machine.
I will try ssh-copy-id command to check if that helps.
Thank you so much.

1 Like

Check your target servers auth or sshd logs. It’ll tell you what auth failure is caused by.

1 Like