commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Siebert <smsi...@gmail.com>
Subject Re: [vfs] Issue encountered when connecting to a SFTP
Date Thu, 06 Jan 2011 10:58:40 GMT
Hi Heshan,

You can either do that (tell VFS where the know-hosts file is):
FileSystemOptions o = new FileSystemOptions ();
SftpFileSystemConfigBuilder.getInstance().setKnownHosts(o, new
File(myKnownHostsDir));
FileObject fo = VFS.getManager().resolveFile(myURI, o);

or tell it to ignore strict host key checking:
FileSystemOptions o = new FileSystemOptions ();
SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(o, "no");
FileObject fo = VFS.getManager().resolveFile(myURI, o);

see http://commons.apache.org/vfs/apidocs/index.html

Cheers,

Steve

On Thu, Jan 6, 2011 at 12:46 AM, Heshan Suriyaarachchi <
heshan.suriyaarachchi@gmail.com> wrote:

> Hi,
>
> I am using VFS to connect to a SFTP. But when I try to connect to it, I am
> getting the following stacktrace. Do I have to import the certificate key
> (of the SFTP that I am trying to connect) to VFS? If so, how to do it?
> Please advice.
>
> Caused by: org.apache.commons.vfs.FileSystemException: Could not connect to
> SFTP
>  server at "example.foo.com".
>        at
> org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnecti
> on(SftpClientFactory.java:233)
>        at
> org.apache.commons.vfs.provider.sftp.SftpFileProvider.doCreateFileSys
> tem(SftpFileProvider.java:95)
>        ... 14 more
> Caused by: com.jcraft.jsch.JSchException: UnknownHostKey: example.foo.com.
> DSA key
> fingerprint is 62:fa:a5:c7:1a:34:f4:05:7a:e8:06:b9:57:e5:de:e3
>        at com.jcraft.jsch.Session.checkHost(Session.java:706)
>        at com.jcraft.jsch.Session.connect(Session.java:307)
>        at com.jcraft.jsch.Session.connect(Session.java:150)
>        at
> org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnecti
> on(SftpClientFactory.java:229)
>        ... 15 more
>
> --
> Regards,
> Heshan Suriyaarachchi
>
> http://heshans.blogspot.com/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message