commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manco <megust...@yahoo.com>
Subject Re: [VFS] Could not connect to SFTP server
Date Tue, 26 Apr 2005 23:12:36 GMT
Mario,
 
Thanks for the clues, unfortunately I still cant get it to work, in fact I have taken a step
back.
 
1. Is there a format for the "known_hosts" file? I tried using the format from linux/etc/hosts,
    still got the same problem.
 
2. I also tried suggestion #2, also no luck, same problem 
 
3. #3 wouldntt be the way I would be using it. I have an app that generates a bunch of files
    either another app or a thread will be running to pick up the generated files and sftp
them
    off to the target, no chance for user interaction.
 
So, I tried doing a full build of vfs using the ant build.xml file. The compile build went
find,
all classes and a jar were/was built, including the test classes. I thouhgt maybe I could
run
the test and use the exact jars & versions as in the build. I attempted to run the 
"internal-tests" target but all it did was make the testreportdir and exit.  I see that there
is 
a project.properties file, but I am not sure what I need to set to use it. 
 
So, I went back to my original test and now I can nolonger use FTP (not sftp),  for some reason,
which I can not figure out I am now getting:
 
94 [main] DEBUG org.apache.commons.vfs.impl.StandardFileSystemManager  - Skipping provider
"org.apache.commons.vfs.provider.ftp.FtpFileProvider" because required class "org.apache.commons.net.ftp.FTPFileX"
is not available.
 
I am using JBuilder and I have commons-net in the required libs, commons-net has a FTPFile.class,
I dont see anything called FTPFileX.
 
thanks,
Manco


Mario Ivankovits <mario@ops.co.at> wrote:
Hi manco!
>Caused by: com.jcraft.jsch.JSchException: UnknownHostKey
> at com.jcraft.jsch.Session.checkHost(Unknown Source)
> at com.jcraft.jsch.Session.connect(Unknown Source)
> at com.jcraft.jsch.Session.connect(Unknown Source)
> at org.apache.commons.vfs.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:138)
> ... 7 more
> 
The host is new for jsch or your ssh environment (known_hosts), so you 
have to trust it or pass the path to your known_hosts file to jasch

1) known_hosts
SftpFileSystemConfigBuilder.getInstance().setKnownHosts(opts, new 
File("path/to/known_hosts"));

2) or turn off the strictHostKeyChecking

FileSystemOptions opts = new FileSystemOptions();

SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, 
"no");
FileObject fo = VFS.getManager().resolveFile("sftp://xxxx", opts);

3) Or create a class which implememnts the
com.jcraft.jsch.UserInfo interface and configure it for your connection

SftpFileSystemConfigBuilder.getInstance().setUserInfo(opts, yourUserInfo);

That way you could implement a user-dialog where you ask the user to 
trust the host.


I hope one of the ways solves your problem.

---
Mario


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


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message