Reputation: 499
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?
Upvotes: 2
Views: 8907
Reputation: 1
Please switch user as jenkins in master node:
sudo su - jenkins 2.Now generate the key using ssh-keygen ssh-keygen
Copy the cat id_rsa to your jenkiens credentials
Copy the cat id_rsa.pub to your agent node ubuntu@agent:~/.ssh$ vi authorized_keys
now test the connection
Hope this weil work for you
Upvotes: 0
Reputation: 1
Use "username with password" credential type, not "SSH Username with private key" :)
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 11
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.
Upvotes: 1