I could perhaps circumvent this problem by adding the build users public key from each slave node to authorized_keys on the server. Then I would not need to use the credentials on Jenkins. However I see that only as a fallback option. Best approach would be to use authentication from Jenkins Crendentials.
mandag 6. juni 2016 09.06.59 UTC+2 skrev Sverre Moe følgende: > > Using the following with ssh I can disable host key verification > ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no > [email protected] > also > scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no *.rpm > [email protected]:/tmp > > Warning: Permanently added 'server.company.com,145.235.17.27' (ECDSA) to > the list of known hosts > But it does not actually add it to know_hosts, which is actually a good > thing. Ignoring host key verification does have consequences. > > > However my next problem still remains. Getting Permission denied > (publickey,keyboard-interactive) > How does it use the credentials private key from Jenkins in the > ssh/scp/rsync command? > > > lørdag 4. juni 2016 15.15.48 UTC+2 skrev Baptiste Mathus følgende: >> >> Did you try passing the host key checking ssh parameter to "no"? >> Le 2 juin 2016 4:10 PM, "Sverre Moe" <[email protected]> a écrit : >> >>> I need to transfer some files to a server. >>> Have followed the suggestion mention in >>> https://issues.jenkins-ci.org/browse/JENKINS-27963 >>> Tried sshagent with both scp and rsync. Neither works. >>> >>> I have created a Credential for this server in Jenkins. >>> >>> Using rsync >>> sshagent(['repository']) { >>> sh "rsync -av *.rpm >>> [email protected]:/srv/www/htdocs/staging_rpms/" >>> } >>> >>> [ssh-agent] Using credentials build (repohost) >>> [ssh-agent] Looking for ssh-agent implementation... >>> [ssh-agent] Java/JNR ssh-agent >>> [ssh-agent] Started. >>> [Pipeline] { >>> [Pipeline] sh >>> [master] Running shell script >>> + rsync -av *.rpm [email protected]:/srv/www/htdocs/staging_rpms >>> Host key verification failed. >>> rsync: connection unexpectedly closed (0 bytes received so far) [sender] >>> rsync error: error in rsync protocol data stream (code 12) at io.c(641) >>> [sender=3.0.4] >>> >>> >>> Using scp >>> sshagent(['repository']) { >>> sh "scp *.rpm [email protected]:/srv/www/htdocs/staging_rpms/" >>> } >>> >>> [ssh-agent] Using credentials build (repohost) >>> [ssh-agent] Looking for ssh-agent implementation... >>> [ssh-agent] Java/JNR ssh-agent >>> [ssh-agent] Started. >>> [Pipeline] { >>> [Pipeline] sh >>> [master] Running shell script >>> + scp *.rpm [email protected]:/srv/www/htdocs/staging_rpms/ >>> Host key verification failed. >>> lost connection >>> >>> Problem because of this: >>> The authenticity of host 'server.company.com (192.24.17.73)' can't be >>> established. >>> ECDSA key fingerprint is 00:00:00:00:00:00:00:bc:cc:51:3f:39:f8:06:df:18 >>> [MD5]. >>> Are you sure you want to continue connecting (yes/no)? yes >>> Warning: Permanently added 'server.company.com' (ECDSA) to the list of >>> known hosts. >>> >>> Fixing this first "manually" and continued. >>> >>> Using rsync >>> [ssh-agent] Using credentials build (repohost) >>> [ssh-agent] Looking for ssh-agent implementation... >>> [ssh-agent] Java/JNR ssh-agent >>> [ssh-agent] Started. >>> [Pipeline] { >>> [Pipeline] sh >>> [master] Running shell script >>> + rsync -av *.rpm [email protected]:/srv/www/htdocs/staging_rpms/ >>> Permission denied (publickey,keyboard-interactive). >>> rsync: connection unexpectedly closed (0 bytes received so far) [sender] >>> rsync error: error in rsync protocol data stream (code 12) at io.c(641) >>> [sender=3.0.4] >>> >>> Using scp >>> [ssh-agent] Using credentials build (repohost) >>> [ssh-agent] Looking for ssh-agent implementation... >>> [ssh-agent] Java/JNR ssh-agent >>> [ssh-agent] Started. >>> [Pipeline] { >>> [Pipeline] sh >>> [master] Running shell script >>> + scp *.rpm [email protected]:/srv/www/htdocs/staging_rpms/ >>> Permission denied (publickey,keyboard-interactive). >>> lost connection >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jenkinsci-users/fb3f547a-32ad-49b0-a012-9dfa69f91a35%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/jenkinsci-users/fb3f547a-32ad-49b0-a012-9dfa69f91a35%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e6decaa2-09d3-4c91-974d-95f649a9c041%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
