Dear Wiki user, You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.
The following page has been changed by WolframLanger: http://wiki.apache.org/commons/VfsFaq The comment on the change is: VFS FAQ: Add question about SFTP, setStrictHostKeyChecking ------------------------------------------------------------------------------ ((DefaultFileSystemManager) fsManager).close(); }}} + == How can I connect to an SFTP server even if there is no entry in known_hosts? == + + JSch, the library that provides VFS with SFTP functionality, checks that the host one tries connecting to is a known host, i.e. has an entry in the file $HOME/.ssh/known_hosts. By default, connections to unkown hosts are rejected by throwing an exception. You can change this behaviour by specifying the strict host key checking option: + + {{{ + FileSystemOptions opts = new FileSystemOptions(); + SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no"); + FileSystemManager fsManager = VFS.getManager(); + FileObject foo = fsManager.resolveFile("sftp://login:passw...@host/foo.bar", opts); + + // Do some stuff + + foo.close(); + ((DefaultFileSystemManager) fsManager).close(); + }}} + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org