i managed to resolve login problem but still facing issue while connecting
my remote server using ssh key to jenkins.

i have shell script also where i am doing ssh connection from local to
remote and normal execution is working fine without jenkins but when i
schedule a build in jenkins it fails. seeking for the suggestions on this
if step by step process can be suggested it will be great help. I am stuck
in this problem from long time.

i followed below steps to resolve it till now but didnt work:

* Create an SSH key pair (public/private)   *Ran the command “ssh-keygen -t
rsa -C "Jenkins agent key" -f "jenkinsAgent_rsa"  “*

* Create an SSH credential in the Jenkins machine and put the private key
there *Created the credentials and put jenkinsAgent_rsa into it.*

* Create an SSH agent see
https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#configure-launch-agents-via-ssh
<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjenkinsci%2Fssh-slaves-plugin%2Fblob%2Fmaster%2Fdoc%2FCONFIGURE.md%23configure-launch-agents-via-ssh&data=02%7C01%7Cssanders%40nycopportunity.nyc.gov%7Ca3b05396379a43b03ffc08d7aa5625a1%7C73d61799c28440228d4154cc4f1929ef%7C0%7C0%7C637165160528450979&sdata=ZwAy47%2Fxj2JYsbcVzz3gIvnFEvY%2BeFromHWpDgfOcoo%3D&reserved=0>
 – *This is creating a node which I didn’t do before – so I created the
node and selected the credential with the private key. The verification
strategy slect is non-verifying.*

  * Select the SSH credential created before as credentials

  * Chose the verification strategy that you want, see the documentation,
if you have problems start with the "Non verifying Verification Strategy"
you can change it later

* Add the public key on ~/.ssh/authorized_keys *This was done*



*I tried to relaunch the node and got the following:*


SSH Connection failed with IOException: "Key exchange was not
finished, connection is closed.", retrying in 15 seconds. There are 1
more retries left.
[07/23/20 11:03:50] [SSH] WARNING: The SSH key for this host does not
match the key required in the connection configuration. Connections
will be denied until the host key matches the configuration key.
Key exchange was not finished, connection is closed.
ERROR: Connection is not established!
java.lang.IllegalStateException: Connection is not established!
        at 
com.trilead.ssh2.Connection.getRemainingAuthMethods(Connection.java:988)
        at 
com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.getRemainingAuthMethods(TrileadSSHPublicKeyAuthenticator.java:88)
        at 
com.cloudbees.jenkins.plugins.sshcredentials.impl.TrileadSSHPublicKeyAuthenticator.canAuthenticate(TrileadSSHPublicKeyAuthenticator.java:80)
        at 
com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:218)
        at 
com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator.newInstance(SSHAuthenticator.java:171)
        at 
hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:863)
        at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:435)
        at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:422)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
[07/23/20 11:04:05] Launch failed - cleaning up connection
[07/23/20 11:04:05] [SSH] Connection closed.



On Thu, Jul 23, 2020 at 8:07 AM Sakshi Rathore <[email protected]>
wrote:

> Unfortunately i dont hv duplicate instance open। I only have ssh-key to
> login to the server which was working before
>
> Any other way to implement this?
>
> On Wed, 22 Jul, 2020, 5:54 PM jeremy mordkoff, <[email protected]>
> wrote:
>
>> ouch. I always keep one window open ssh'd in as root when I play with
>> sshd_config. Hopefully you have console access and a username/password with
>> sudo rights.
>>
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/366717fe-86d5-4f83-8990-7584308b3a36o%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/366717fe-86d5-4f83-8990-7584308b3a36o%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAJeB3MN%3DeoGkg8L5daTOHtb2CKtF59PYUvwMWgTCV5-S8QXUSw%40mail.gmail.com.

Reply via email to