You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by steve <st...@dyrdahl.net> on 2003/06/10 17:01:53 UTC

[VFS] [PATCH] SftpFileProvider.java

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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [VFS] [PATCH] SftpFileProvider.java

Posted by Adam Murdoch <ad...@apache.org>.
Hi,

This has been committed.  Thanks for the patch.

On Wed, 11 Jun 2003 01:01 am, steve wrote:
> Key based authentication simply requires loading the private key. 

Does it work if there is a passphrase on 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).

Yes it would.  I'd like to add some general purpose way of configuring 
providers at some point.

-- 
Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org