Key based authentication simply requires loading the private key.  This patch is a bit 
of a cludge.  It might be nice to configure properties for where to look for the key 
file (and the known hosts for that matter).

Index: SftpFileProvider.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/sftp/SftpFileProvider.java,v
retrieving revision 1.1
diff -r1.1 SftpFileProvider.java
64a65,67
> import com.jcraft.jsch.JSchException;
>
> import java.io.File;
83a87
>         String privateKeyPath = null;
92c96,101
<             knownHostsPath = System.getProperty( "user.home") + "/.ssh/known_hosts";
---
>             String userHome = System.getProperty( "user.home" );
>             knownHostsPath = userHome + "/.ssh/known_hosts";
>             File f = new File(userHome + "/.ssh/id_rsa");
>             if(f.canRead()) {
>                 privateKeyPath = f.getAbsolutePath();
>             }
94d102
<
95a104,110
>         if(privateKeyPath!=null) {
>             try {
>                 jSch.addIdentity(privateKeyPath);
>             } catch (JSchException e) {
>                 throw new FileSystemException(e);
>             }
>         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to