Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 24869 invoked from network); 6 Jan 2011 10:59:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Jan 2011 10:59:34 -0000 Received: (qmail 78520 invoked by uid 500); 6 Jan 2011 10:59:33 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 78113 invoked by uid 500); 6 Jan 2011 10:59:30 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 78105 invoked by uid 99); 6 Jan 2011 10:59:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jan 2011 10:59:29 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of smsiebe@gmail.com designates 209.85.214.171 as permitted sender) Received: from [209.85.214.171] (HELO mail-iw0-f171.google.com) (209.85.214.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jan 2011 10:59:23 +0000 Received: by iwn2 with SMTP id 2so15793955iwn.30 for ; Thu, 06 Jan 2011 02:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=0DJrjFPW3pfsOw9P3tg4Qi+5m0AAbGWVr/1KHfmZl+M=; b=U/C16BSm3Z3TiITe808pJZjFC+TkfkIl9UVxlpC2N0JG1ys9VPD7+aTK7WBC/mRqnT 06NHDqDKscnUCqol0mvkh94IHrIaRmtDCO+FQmDRT8h8E6mmI81dl2TplPoeihcvmmO3 QNhfpvm3QZOosYctBuc1zKzmeHSBqM3vPndfU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=tZhyPA0J7vulNIVMzc4iRrdCkWLsGL9I93w8R6siIts/8mLyjwmFgljT8Nko8vTfoG neIzw7BO00T8pjx6d3ECl1WArzXnkk794BO9Utor/03H9ZRoPk3S24aWD2OxEVnLC8pf 0vh9x8iqIicW7CvejhE+92hilwROWEMGMyP/Y= Received: by 10.231.30.73 with SMTP id t9mr13997379ibc.64.1294311541076; Thu, 06 Jan 2011 02:59:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.19.73 with HTTP; Thu, 6 Jan 2011 02:58:40 -0800 (PST) In-Reply-To: References: From: Steven Siebert Date: Thu, 6 Jan 2011 05:58:40 -0500 Message-ID: Subject: Re: [vfs] Issue encountered when connecting to a SFTP To: Commons Users List Content-Type: multipart/alternative; boundary=0022152d607da273f104992b63a1 X-Virus-Checked: Checked by ClamAV on apache.org --0022152d607da273f104992b63a1 Content-Type: text/plain; charset=ISO-8859-1 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 < heshan.suriyaarachchi@gmail.com> 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/ > --0022152d607da273f104992b63a1--