title: WSO2 ESB: SFTP file transfer: Could not connect to SFTP server
body: <p>I am trying to transfer some files from local server to SFTP server using WSO2 Enterprise Integrator 6.3.0. I have username, SFTP location, SFTP port(990), ppk file and PassPhrase. When I tried below configuration in my Proxy service, I couldn't connect to SFTP server. It gives com.jcraft.jsch.JSchException: Auth fail error. With putty, connection works.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy name="SFTPFileTransferProxy" startOnLoad="true"
    trace="disable" transports="vfs" xmlns="http://ws.apache.org/ns/synapse"&gt;
    &lt;target&gt;
      &lt;inSequence&gt;
        &lt;property expression="$trp:FILE_NAME" name="FILE_NAME"
          scope="default" type="STRING"/&gt;
        &lt;log level="custom"&gt;
          &lt;property expression="$ctx:FILE_NAME" name="FL2"/&gt;
          &lt;property name="sequence" value="FTPProxy"/&gt;
        &lt;/log&gt;
      &lt;/inSequence&gt;
      &lt;outSequence/&gt;
      &lt;faultSequence/&gt;
    &lt;/target&gt;
    &lt;parameter name="transport.PollInterval"&gt;10000ms&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.FileURI"&gt;file:///C:/files/out&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.ContentType"&gt;text/plain&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.ActionAfterProcess"&gt;MOVE&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.MoveAfterFailure"&gt;file:///C:/test/failure&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.SFTPIdentities"&gt;file:///C:/sftp/keys/PrivateKey_Integration.ppk&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.ActionAfterFailure"&gt;MOVE&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.FileNamePattern"&gt;.*\.csv&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.MoveAfterProcess"&gt;vfs:sftp://username@sftp.XXXX.com:990/in/file/&lt;/parameter&gt;
    &lt;parameter name="transport.vfs.SFTPIdentityPassPhrase"&gt;KEY_PASSPHRASE&lt;/parameter&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>And the error I am getting is</p>
  
  <pre><code>[2019-02-04 12:48:31,823] [] ERROR - VFSTransportListener File object 'file:///C:/files/out/20181226FULL.csv'cloud not be moved, will remain in "locked" state
  org.apache.axis2.AxisFault: Error resolving directory to move after processing : sftp://username@sftp.XXXX.com:990/in/file
          at org.apache.axis2.transport.base.AbstractTransportListener.handleException(AbstractTransportListener.java:343)
          at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:715)
          at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:504)
          at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
          at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
          at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
          at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
          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)
  Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp://username@sftp.XXXX.com:990/".
          at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:86)
          at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:149)
          at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:111)
          at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:81)
          at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:778)
          at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:658)
          at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:667)
          ... 8 more
  Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp.XXXX.com".
          at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:164)
          at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:79)
          ... 14 more
  Caused by: 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 org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:162)
          ... 15 more
  </code></pre>
  
  <p>How to connect SFTP server with SFTPIdentities?</p>