[vfs] Issue encountered when connecting to a SFTP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[vfs] Issue encountered when connecting to a SFTP

Heshan Suriyaarachchi
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/
Reply | Threaded
Open this post in threaded view
|

Re: [vfs] Issue encountered when connecting to a SFTP

Steve Siebert
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 <
[hidden email]> 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/
>
Reply | Threaded
Open this post in threaded view
|

Re: [vfs] Issue encountered when connecting to a SFTP

Heshan Suriyaarachchi
Hi Steve,

Thanks for the response :)

On Thu, Jan 6, 2011 at 4:28 PM, Steven Siebert <[hidden email]> wrote:

> 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 <
> [hidden email]> 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/
> >
>



--
Regards,
Heshan Suriyaarachchi

http://heshans.blogspot.com/