commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject Re: [VFS] Could not connect to SFTP server
Date Sat, 23 Apr 2005 05:22:26 GMT
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


Mime
View raw message