title: com.jcraft.jsch.JSchException: Auth cancel
body: <p>I'm trying to write an Ant script to retrieve an URL via port tunnelling.</p>
  
  <p>It works great when I use a password (the names xxxx'd out for privacy):</p>
  
  <pre><code>&lt;project default="main"&gt;
    &lt;target name="main"&gt;
      &lt;sshsession host="xxxx"
      username="xxxx"
      password="xxxx"&gt;
        &lt;LocalTunnel lport="1080" rhost="xxxx" rport="80"/&gt;
        &lt;sequential&gt;
          &lt;get src="http://localhost:1080/xxxx" dest="/tmp/xxxx"/&gt;
        &lt;/sequential&gt;
      &lt;/sshsession&gt;
    &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>But it doesn't work when I use a keyfile, like this:</p>
  
  <pre><code>    &lt;sshsession host="xxxx"
      username="xxxx"
      keyfile="/Users/xxxx/.ssh/id_dsa"
      passphrase="xxxx"&gt;
        &lt;LocalTunnel lport="1080" rhost="xxxx" rport="80"/&gt;
        &lt;sequential&gt;
          &lt;get src="http://localhost:1080/xxxx" dest="/tmp/xxxx"/&gt;
        &lt;/sequential&gt;
      &lt;/sshsession&gt;
  </code></pre>
  
  <p>I get this exception:</p>
  
  <pre><code>/tmp/build.xml:8: com.jcraft.jsch.JSchException: Auth cancel
      at com.jcraft.jsch.Session.connect(Session.java:451)
      at com.jcraft.jsch.Session.connect(Session.java:150)
      at org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:223)
  </code></pre>
  
  <ul>
  <li>I'm sure I'm using the correct keyfile (I've tried using the wrong name, which gives a legitimate FileNotFoundException).</li>
  <li>I can successfully ssh from the command line without being prompted for a password.</li>
  <li>I'm sure I'm using the correct passphrase for the keyfile.</li>
  </ul>
  
  <p>What's the cause of this error and what can I do about it?</p>