title: withCredentials sshUserPrivateKey in Jenkins failed auth fail
body: <p>I used Jenkinsfile in Linux to do SSH to Windows server,
  Here is my Jenkinsfile:</p>
  <pre><code>pipeline {
    agent any
    tools { nodejs &quot;node&quot; }
  
    environment {
      HOST = &quot;${IP_ADDRESS}&quot;
    }
  
    stages {
      stage(&quot;Remote SSH&quot;) {
        steps {
          script {
            withCredentials([sshUserPrivateKey(credentialsId: 'build-server-id-rsa', keyFileVariable: 'key')]) {
              def remote = [name: &quot;${HOST}&quot;, host: &quot;${HOST}&quot;, user: &quot;jenkins&quot;, allowAnyHosts: true, identityFile: key]
              sshCommand remote: remote, sudo: true, command: &quot;npm install&quot;
            }
          }
        }
      }
    }
  }
  
  </code></pre>
  <p>However, I kept getting errors about <code>auth fail</code>:</p>
  <pre><code>com.jcraft.jsch.JSchException: Auth fail
      at com.jcraft.jsch.Session.connect(Session.java:519)
      at com.jcraft.jsch.Session.connect(Session.java:183)
      at com.jcraft.jsch.Session$connect$1.call(Unknown Source)
      at org.hidetake.groovy.ssh.connection.ConnectionManager.connectInternal(ConnectionManager.groovy:107)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190)
      at org.hidetake.groovy.ssh.connection.ConnectionManager$_connectInternal_closure1.doCall(ConnectionManager.groovy:85)
      at org.hidetake.groovy.ssh.connection.ConnectionManager$_connectInternal_closure1.doCall(ConnectionManager.groovy)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
      at org.hidetake.groovy.ssh.util.Utility.retry(Utility.groovy:52)
      at org.hidetake.groovy.ssh.util.Utility$retry.callStatic(Unknown Source)
      at org.hidetake.groovy.ssh.connection.ConnectionManager.connectInternal(ConnectionManager.groovy:83)
      at org.hidetake.groovy.ssh.connection.ConnectionManager.connectInternal(ConnectionManager.groovy)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
      at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
      at org.hidetake.groovy.ssh.connection.ConnectionManager.connect(ConnectionManager.groovy:59)
      at org.hidetake.groovy.ssh.connection.ConnectionManager$connect.call(Unknown Source)
      at org.hidetake.groovy.ssh.session.SessionTask.wetRun(SessionTask.groovy:61)
      at org.hidetake.groovy.ssh.session.SessionTask.call(SessionTask.groovy:48)
      at java_util_concurrent_Callable$call.call(Unknown Source)
      at org.hidetake.groovy.ssh.core.Service.run(Service.groovy:81)
      at org.hidetake.groovy.ssh.core.Service$run$0.call(Unknown Source)
      at org.jenkinsci.plugins.sshsteps.SSHService.executeCommand(SSHService.groovy:177)
      at org.jenkinsci.plugins.sshsteps.steps.CommandStep$Execution$CommandCallable.execute(CommandStep.java:84)
      at org.jenkinsci.plugins.sshsteps.util.SSHMasterToSlaveCallable.call(SSHMasterToSlaveCallable.java:32)
      at hudson.remoting.LocalChannel.call(LocalChannel.java:47)
      at org.jenkinsci.plugins.sshsteps.steps.CommandStep$Execution.run(CommandStep.java:72)
      at org.jenkinsci.plugins.sshsteps.util.SSHStepExecution.lambda$start$0(SSHStepExecution.java:84)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  <p>Update 1. include the top of the jenkins job execution page:</p>
  <pre><code>Started by user Admin
  Running in Durability level: MAX_SURVIVABILITY
  [Pipeline] Start of Pipeline
  [Pipeline] node
  Running on Jenkins in /var/lib/jenkins/workspace/testing
  [Pipeline] {
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] stage
  [Pipeline] { (Declarative: Tool Install)
  [Pipeline] tool
  [Pipeline] envVarsForTool
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] stage
  [Pipeline] { (Remote SSH)
  [Pipeline] tool
  [Pipeline] envVarsForTool
  [Pipeline] withEnv
  </code></pre>