I have already added the host to ~/.ssh/known_hosts, so using StrictHostKeyChecking=no is no longer necessary. What I am experiencing now is authentication problem. It does not use the credentials with the ssh connection. Thus I receive Permission denied (publickey,keyboard-interactive).
My credentials contain the private key for the username I use in the ssh command. Wonder if the problem lies not with sshagent, but elsewhere. I have tried the following command manually with the same private-key stored in Jenkins for this user and it still asks for password. ssh -i private.key bu...@server.company.com Password: Password: Password: Permission denied (publickey,keyboard-interactive). However still do sshagent supply the private key when executing ssh? mandag 13. juni 2016 14.36.38 UTC+2 skrev Baptiste Mathus følgende: > > Indeed in my case I had disabled host key checking. > > What works for me is: > > sshagent(['some-id']) { > > sh """ > ssh -o StrictHostKeyChecking=no marmotte@marmotte "docker > create -v /var/jenkins_home --name ze-data jenkins:1.642.1 || echo 'data > container already existing?' " > .... > """ > } > > 2016-06-13 9:53 GMT+00:00 Sverre Moe <sverr...@gmail.com <javascript:>>: > >> Am i missing something in my script content? >> sshagent(['repository']) { >> sh 'ssh -Xf bu...@repo.company.com <javascript:> ls -l /home/build/ ' >> } >> >> When executing ssh within sshagent I am getting >> Permission denied (publickey,keyboard-interactive). >> >> The credential repository has the private key for the user build. >> >> torsdag 2. juni 2016 16.10.16 UTC+2 skrev Sverre Moe følgende: >>> >>> 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 >>> r...@server.company.com:/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 r...@server.company.com:/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 r...@server.company.com:/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 r...@server.company.com:/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 r...@server.company.com:/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 r...@server.company.com:/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 jenkinsci-use...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/db0ba327-53d3-46f4-a09d-feeb3d539104%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/db0ba327-53d3-46f4-a09d-feeb3d539104%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 jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/434015fa-5aa1-4d03-ac0a-93eada305d53%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.