+-From: "Sidambara Raja Krishnaraj" <Sidambara_RK@...> --
|_Date: Mon, 27 Oct 2003 11:29:37 +0530 _________________________
|We are currently working on a project where we need to
|use SFTP for file transfer. We are using Apache-VFS for the
|same which internally uses jsch for SSH file transfer. When
|we try to transfer the file we get following exception from jsch:
| at com.jcraft.jsch.Session.checkHost(Unknown Source)
| at com.jcraft.jsch.Session.connect(Unknown Source)
| at org.apache.commons.vfs.provider.sftp.SftpFileSystem.getChannel(SftpFileS
|We are in the critical state in the project. I would appreciate if
|somebody could get back on the solution for the above problem.
I'm not famiilar with how jsch is integrated into
but I think there are some ways for that problem.
(1) set 'StrickHostKeyChecking' as 'no'.
Suppose that you have 'session' which is an instance of
java.util.Hashtable config=new java.Util.Hashtable();
(2) give jsch the 'known_hosts' file, which includes the remote hostkey.
Suppose that you have 'jsch' which is an instance of
jsch.setKnownHosts("pathname of known_hosts");
(3) set an instance of com.jcraft.jsch.UserInfo to session,
UserInfo ui=new YourUserInfo();
ui.promptYesNo method will be invoked to prompt if remote hostkey is
acceptable or not.
From the security point of view, I will not recommend (1) ,
however if the promptYesNo method defined in (3) does not prompt for the
human and always return true, there may not be any difference between (1) and
(3). If your program runs in the batch mode, I will recommend (2).
+-From: ymnk@... (Atsuhiko Yamanaka) --
|_Date: Mon, 27 Oct 2003 16:42:34 +0900 ______
| (1) set 'StrickHostKeyChecking' as 'no'.
| Suppose that you have 'session' which is an instance of com.jcraft.jsch.Session,
| (3) set an instance of com.jcraft.jsch.UserInfo to session,
| UserInfo ui=new YourUserInfo();
I have refereed to the source code of org.apache.commons.vfs.provider.sftp package
and it seems instances of Session and JSch classes are not accessible, to my regret.
There should be some modifications to 'SftpFileProvider' class to get those