There are two SSH keys involved when establishing a session The one you are setting here is the key used ti identify the client to the server (host). There is also the key that the server (host) sends down to the client. You can see this the first time you ssh to a host and it asks you if you want to accept the key. Once you do accept it, it is stored in .ssh/known_hosts and subsequent connections are verified automatically.
You have two choices. Disable host key verification or add the host key manually to jenkins' known_hosts file. to disable host key checking, add this to your .ssh/config StrictHostKeyChecking no This can also be done on the commandline .. something like -o StrictHostKeyChecking=no or you can pre-create the known_hosts file. One way would be to delete it, ssh to the host manually and then examine the known_hosts file. There should be one line in it something like this jenkins7,10.64.10.74 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNiUivaQ4skdl0sc0A/a0aFxA1p/Sd/6AcYpZcjC0UA9YaO5ADJT+Ercb9fHrcuQdiEOMi36LVNdS5TY1EeFYzs= copy that into jenkins' known_hosts file On Wednesday, July 29, 2020 at 2:50:04 AM UTC-4, Sakshi Rathore wrote: > > below is the part of my script where i am doing ssh and it works fine in > local. > > scp -i $SSHKEY_PATH $CERT_PATH ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH $KEY_FILE ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH $CRT_FILE ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH ./check.sh ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH ./old_server.sh ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH ./cert_status1.sh ccpuser@10.32.141.35:/home/ccpuser > scp -i $SSHKEY_PATH ./new_server_cert.sh ccpuser@10.32.141.35:/home/ccpuser > > sed -i -e 's/\r$//' ./check.sh > sed -i -e 's/\r$//' ./old_server.sh > sed -i -e 's/\r$//' ./cert_status1.sh > sed -i -e 's/\r$//' ./old_server.sh > sed -i -e 's/\r$//' ./new_server_cert.sh > > > echo "check1" > > ssh -i $SSHKEY_PATH ccp...@10.32.141.35 <javascript:> /bin/bash <<EOF > > this ssh key belongs to server login > > when i try to execute this using jenkins build: > Warning: Identity file > /c/Users/D35N/Downloads/GitHubProjeckt/Automation/GitHubProjeckt/newharbortestkey > > not accessible: No such file or directory. > Host key verification failed. > lost connection > I have generated ssh key in ssh server for jenkins and put public key into > home/.ssh/authorized_keys location and private key for ssh setup in > jenkins but i am not able to connect to the ssh server > i also tried simple ssh to the server in build step but it is not working. > Please advise where I am wrong. > > On Wed, Jul 29, 2020 at 8:35 AM Sakshi Rathore <sakshira...@gmail.com > <javascript:>> wrote: > >> I tried a lot of things but my ssh connection is not working from jenkins >> to ssh server. >> >> One more thing my Jenkins and ssh server is hosting on same IP address is >> there anyway i can resolve this issue? >> >> On Mon, 27 Jul, 2020, 9:39 AM Sakshi Rathore, <sakshira...@gmail.com >> <javascript:>> wrote: >> >>> thanks , i tried this as well but while getting connection >>> encountring below error: >>> >>> Permission denied (publickey,password,keyboard-interactive) >>> build marked as failed. >>> >>> On Thu, Jul 23, 2020 at 3:47 PM jeremy mordkoff <jeremy....@riftio.com >>> <javascript:>> wrote: >>> >>>> I think the issue is that the client does not trust the server's host >>>> key. These keys are stored by the client in ~/.ssh/known_hosts Try >>>> copying/appending your .ssh/known_hosts file to jenkins' >>>> >>>> >>>> >>>> On Monday, July 20, 2020 at 5:43:39 PM UTC-4, Sakshi Rathore wrote: >>>>> >>>>> 0I have a bash script which connects and exexutes programs from my >>>>> local to remote server and now this should be executed from jenkins build >>>>> so for this jenkins is taking continous changes from git for this script >>>>> but my build is failing with below error: >>>>> >>>>> Warning: Identity file >>>>> /c/Users/D35N/Downloads/GitHubProjeckt/Automation/GitHubProjeckt/newharbortestkey >>>>> >>>>> not accessible: No such file or directory. Host key verification failed. >>>>> Build step 'Execute shell' marked build as failure >>>>> >>>>> I have tried to set ssh connectivity in my jenkins server for this >>>>> remote server incredentials and ssh plugins but using my key i am getting >>>>> an error cant connect to the server. >>>>> >>>>> when i run the script from local it works fine and my ssh connection >>>>> gets established properly using SSH key. >>>>> >>>>> jenkins server is also integrated or installed on my kuberenets >>>>> cluster which is my remote server in this case and bash script should >>>>> execute on this kuberenets cluster. >>>>> >>>>> i generated ley for jenkins in remote server and using this key for >>>>> ssh plugin setup but i am getting cant connect to the server error >>>>> everytime. >>>>> >>>> -- >>>> 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 jenkins...@googlegroups.com <javascript:>. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/092a6094-5f76-40bf-b2f6-0accc42e6f57o%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/jenkinsci-users/092a6094-5f76-40bf-b2f6-0accc42e6f57o%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- 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/b0fad762-558d-4e32-83c3-8238ddac0a62o%40googlegroups.com.