Why I am getting error 'Server rejected the 1 private key' error on setting up ssh-slave Docker image












0















I am running both Jenkins master and slave as Docker containers by using jenkins/jenkins:lts and jenkins/ssh-slave image on Ubuntu. Following are the steps:




  • Ran ssh-keygen inside the jenkins-master container (docker exec -it container_id bash) to generate the ssh keys

  • Added the generated public key to authorized_keys file inside ssh-slave container using dockerfile

  • Added private key inside Jenkins credentials as per this link


I have looked at many questions related to this issue on Stack Overflow but I am stuck with following error:




[02/08/19 20:31:06] [SSH] Opening SSH connection to ###.##.#.#:22.
[02/08/19 20:31:06] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:worker-ssh/method:publickey)
[02/08/19 20:31:06] [SSH] Authentication failed.
Authentication failed.

[02/08/19 20:31:06] Launch failed - cleaning up connection
[02/08/19 20:31:06] [SSH] Connection closed.


Slave Template in Jenkins:



Name: jenkins-worker



Usage: Use this node as much as possible



Launch method: Launch agent via SSH



Hostname: my ip extracted from ifconfig



Host key verification startegy: known hosts file verification strategy (.ssh/known_hosts contains entry for host ip provided)



Dockerfile for ssh-slave



    #Docker version 18.09.1
FROM jenkins/ssh-slave
COPY /.ssh/id_rsa.pub /.ssh/authorized_keys
RUN chmod 744 /.ssh/authorized_keys









share|improve this question

























  • "I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

    – jayhendren
    Feb 10 at 21:33











  • I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

    – bot
    Feb 11 at 14:31
















0















I am running both Jenkins master and slave as Docker containers by using jenkins/jenkins:lts and jenkins/ssh-slave image on Ubuntu. Following are the steps:




  • Ran ssh-keygen inside the jenkins-master container (docker exec -it container_id bash) to generate the ssh keys

  • Added the generated public key to authorized_keys file inside ssh-slave container using dockerfile

  • Added private key inside Jenkins credentials as per this link


I have looked at many questions related to this issue on Stack Overflow but I am stuck with following error:




[02/08/19 20:31:06] [SSH] Opening SSH connection to ###.##.#.#:22.
[02/08/19 20:31:06] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:worker-ssh/method:publickey)
[02/08/19 20:31:06] [SSH] Authentication failed.
Authentication failed.

[02/08/19 20:31:06] Launch failed - cleaning up connection
[02/08/19 20:31:06] [SSH] Connection closed.


Slave Template in Jenkins:



Name: jenkins-worker



Usage: Use this node as much as possible



Launch method: Launch agent via SSH



Hostname: my ip extracted from ifconfig



Host key verification startegy: known hosts file verification strategy (.ssh/known_hosts contains entry for host ip provided)



Dockerfile for ssh-slave



    #Docker version 18.09.1
FROM jenkins/ssh-slave
COPY /.ssh/id_rsa.pub /.ssh/authorized_keys
RUN chmod 744 /.ssh/authorized_keys









share|improve this question

























  • "I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

    – jayhendren
    Feb 10 at 21:33











  • I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

    – bot
    Feb 11 at 14:31














0












0








0








I am running both Jenkins master and slave as Docker containers by using jenkins/jenkins:lts and jenkins/ssh-slave image on Ubuntu. Following are the steps:




  • Ran ssh-keygen inside the jenkins-master container (docker exec -it container_id bash) to generate the ssh keys

  • Added the generated public key to authorized_keys file inside ssh-slave container using dockerfile

  • Added private key inside Jenkins credentials as per this link


I have looked at many questions related to this issue on Stack Overflow but I am stuck with following error:




[02/08/19 20:31:06] [SSH] Opening SSH connection to ###.##.#.#:22.
[02/08/19 20:31:06] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:worker-ssh/method:publickey)
[02/08/19 20:31:06] [SSH] Authentication failed.
Authentication failed.

[02/08/19 20:31:06] Launch failed - cleaning up connection
[02/08/19 20:31:06] [SSH] Connection closed.


Slave Template in Jenkins:



Name: jenkins-worker



Usage: Use this node as much as possible



Launch method: Launch agent via SSH



Hostname: my ip extracted from ifconfig



Host key verification startegy: known hosts file verification strategy (.ssh/known_hosts contains entry for host ip provided)



Dockerfile for ssh-slave



    #Docker version 18.09.1
FROM jenkins/ssh-slave
COPY /.ssh/id_rsa.pub /.ssh/authorized_keys
RUN chmod 744 /.ssh/authorized_keys









share|improve this question
















I am running both Jenkins master and slave as Docker containers by using jenkins/jenkins:lts and jenkins/ssh-slave image on Ubuntu. Following are the steps:




  • Ran ssh-keygen inside the jenkins-master container (docker exec -it container_id bash) to generate the ssh keys

  • Added the generated public key to authorized_keys file inside ssh-slave container using dockerfile

  • Added private key inside Jenkins credentials as per this link


I have looked at many questions related to this issue on Stack Overflow but I am stuck with following error:




[02/08/19 20:31:06] [SSH] Opening SSH connection to ###.##.#.#:22.
[02/08/19 20:31:06] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
ERROR: Server rejected the 1 private key(s) for jenkins (credentialId:worker-ssh/method:publickey)
[02/08/19 20:31:06] [SSH] Authentication failed.
Authentication failed.

[02/08/19 20:31:06] Launch failed - cleaning up connection
[02/08/19 20:31:06] [SSH] Connection closed.


Slave Template in Jenkins:



Name: jenkins-worker



Usage: Use this node as much as possible



Launch method: Launch agent via SSH



Hostname: my ip extracted from ifconfig



Host key verification startegy: known hosts file verification strategy (.ssh/known_hosts contains entry for host ip provided)



Dockerfile for ssh-slave



    #Docker version 18.09.1
FROM jenkins/ssh-slave
COPY /.ssh/id_rsa.pub /.ssh/authorized_keys
RUN chmod 744 /.ssh/authorized_keys






ssh authentication jenkins






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 11 at 19:03









Scott

16.1k113990




16.1k113990










asked Feb 8 at 23:46









botbot

11




11













  • "I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

    – jayhendren
    Feb 10 at 21:33











  • I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

    – bot
    Feb 11 at 14:31



















  • "I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

    – jayhendren
    Feb 10 at 21:33











  • I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

    – bot
    Feb 11 at 14:31

















"I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

– jayhendren
Feb 10 at 21:33





"I added my private key in the credentials to ssh into the slave" - you need to add your public key to the authorized_keys file on the slave, not your private key.

– jayhendren
Feb 10 at 21:33













I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

– bot
Feb 11 at 14:31





I have added my public key in authorized_key folder at slave and private key as a credential to ssh on Jenkins. I have updated my question with clear description.

– bot
Feb 11 at 14:31










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403715%2fwhy-i-am-getting-error-server-rejected-the-1-private-key-error-on-setting-up-s%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403715%2fwhy-i-am-getting-error-server-rejected-the-1-private-key-error-on-setting-up-s%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to make a Squid Proxy server?

Is this a new Fibonacci Identity?

19世紀