-
Bug
-
Resolution: Not A Defect
-
Major
-
linux
I have a master running with user XXX on a machine M1. I want to run a slave on machine M2 with user YYY. I have a private-public key in place between the two machines so that I can do
[XXX@M1]$ ssh YYY@M2
and I am connected.
In Jenkins, I created credentials for username M2 and selected the option From the Jenkins master ~/.ssh. But when I try to connect it fails :
[04/18/13 14:58:11] [SSH] Opening SSH connection to M2:22.
ERROR: Failed to authenticate as YYY with credential=c2cdc4dd-cb39-4f15-8329-033933ad5621
java.io.IOException: Publickey authentication failed.
[04/18/13 14:58:11] [SSH] Authentication failed.
hudson.AbortException: Authentication failed.
Surprisingly, if I use the option Enter directly and copy paste the private key from ~/.ssh/id_dsa , then it works.
What am I doing wrong ? is it that it takes ~/.ssh/id_rsa instead of id_dsa ?
The order of preference is: id_rsa, id_dsa, identity
https://github.com/jenkinsci/ssh-credentials-plugin/blob/master/src/main/java/com/cloudbees/jenkins/plugins/sshcredentials/impl/BasicSSHUserPrivateKey.java#L348
So it will take ~/.ssh/id_rsa if that is present and only fall back to ~/.ssh/id_dsa if the id_rsa is missing.
Where you have multiple keys and you need to specify explicitly one key, the recommendation is to either specify the path to the file or use copy & paste