Normally a SSH keypair is created on the client (in your case the jenkins 
server) and then the public key is copied to the server. This is more 
secure because the private key is created on the client and is never copied 
anywhere else. 

This level of security is rarely needed or enforced in a lab, but it is a 
good habit anyway. 

Make sure the keys you use for jenkins do not have a pass-phrase.




On Wednesday, July 29, 2020 at 9:37:06 AM UTC-4, sakshira...@gmail.com 
wrote:
>
> thanks, i try this way . Could you please also suggest  Create an SSH key 
> pair  this step should be executed on jenkins server or ssh server. till 
> now i have executed on ssh server 
>
> On Wednesday, July 29, 2020 at 2:38:02 PM UTC+2 ice...@googlemail.com 
> wrote:
>
>>
>>>    - 
>>>    
>>>    
>>>    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.
>>>    
>>> These steps are fine
>>  
>>
>>>
>>>    - 
>>>    
>>>    Create an SSH agent see 
>>>    
>>> https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/doc/CONFIGURE.md#configure-launch-agents-via-ssh
>>>  – 
>>>    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
>>>       
>>>
>> This doing something completly different, you  are creating a jenkins 
>> agent via ssh,  what you need is an ssh-agent. 
>>
>> I assume you are using pipelines, the wrap the ssh-calling sh step in an 
>> sshagent wrapper (best to use the Snippet generator for the details).
>>  
>>
>>>
>>>    - 
>>>    
>>>    Add the public key on ~/.ssh/authorized_keys This was done
>>>    
>>>
>> Fine again ( at least if ~ expand to the correct user (whatever jenkins 
>> is running the agent as), unless you also explicitly specify the user in 
>> your ssh requests.  From the log it looks like
>> the agent is running as root (no a good idea, but that is another thing), 
>> so you would need to add the key to /root/.ssh/authorized_keys (and 
>> possibly allow remote root logins in the sshd config).
>>
>> but i am not able to establish the connection between jenkins and ssh 
>>> server
>>> my ssh and jenkins server both are hosted on same ip
>>>
>>

-- 
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/28acd998-8882-4b05-942f-5429f87f0368o%40googlegroups.com.

Reply via email to