Jenkins pipeline - ssh to different machine and where to store credentials (using ssh/SSHAgent plugin/etc...)
<p><strong>TLDR</strong>: how to ssh a different machine and where to store ssh credentials on Jenkins pipeline (using ssh / SSHAgent plugin /etc...) ?</p>
<p><strong>The Problem:</strong> In Jenkins pipeline I need a remote ssh to target machine.
My old approach was to use &quot;Execute shell scripts on remote host using ssh&quot;. I would like to specify both username and password.</p>
<p>I've read that the groovy approach shoud be something like</p>
<pre><code>sshagent(['RemoteCredentials']) {
    sh 'ssh -o StrictHostKeyChecking=no -l remoteusername remotetarget uname -a'
  }
</code></pre>
<p>RemoteCredentials: it is the private key with passphrase</p>
<p>Is there a way to make ssh with username/password remote credentials? The sshagent does not support username/password auth</p>
<p>Riccardo</p>