2
votes

I've set up a Jenkins master (user:jenkins) and a Jenkins slave (user: jenkinslave).

I established an SSH connection between them, and I'm able to SSH from master to slave. I configured the slave node, gave the remote root directory (/var/lib/jenkinslave) and launched it using "Launch slaves using SSH" method. But the slave is offline; I've tried all the host verification strategies, but I'm still getting:

[SSH] Authentication failed.

I'm able to establish the SSH connection, but the authentication is failing. I've provided the jenkinslave credentials and they're correct.

Manually trusted key strategy:

[09/29/17 16:51:17] [SSH] Opening SSH connection to ip-10-0-2-218.ap-south-1.compute.internal:22.
[09/29/17 16:51:17] [SSH] SSH host key matches key seen previously for this host. Connection will be allowed.
[09/29/17 16:51:17] [SSH] Authentication failed.
Authentication failed.
[09/29/17 16:51:17] Launch failed - cleaning up connection
[09/29/17 16:51:17] [SSH] Connection closed

Host key strategy:

[09/29/17 16:53:40] [SSH] Opening SSH connection to ip-10-0-2-218.ap-south-1.compute.internal:22.
[09/29/17 16:53:41] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
[09/29/17 16:53:41] [SSH] Authentication failed.
Authentication failed.
[09/29/17 16:53:41] Launch failed - cleaning up connection
[09/29/17 16:53:41] [SSH] Connection closed.

I've read a few articles where they suggested to use a manual key, which I did above, and still the authentication failed. What am I missing out here?

2

2 Answers

1
votes

I faced this same problem. I tried many things, but it did not work. I gave up using ssh to connect and I chose "Launch agent via command execution in master"

ssh -i PATH_TO_KEY_WITHOUT_PASSPHRASE USER @ HOST "cd AGENT_HOME_DIR && curl -O http: //JENKINS_URL/jnlpJars/slave.jar && java -jar slave.jar"

This worked perfectly.

See Run SSH Agent using a command on Master.

0
votes

Did you create your ssh key in ~jenkins/.ssh on the master? Try the following:

ln -s ~jenkins/.ssh ~jenkins/ssh

It's irrational to me too, but it worked in my case.