You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Marcel Ruff <mr...@marcelruff.info> on 2003/11/07 21:00:11 UTC
[vfs] Howto setup sftp?
Hi,
i have downloaded commons-vfs-20031106.tar.gz
and compiled in on Linux 2.4.21 with SUN JDK 1.4.1.
I need to use the scp feature with 'sftp'.
Is there any tutorial how to setup everything?
Here is my problem:
/opt/commons-vfs> java org.apache.commons.vfs.example.Shell
> cp LICENSE.txt ftp://mrf:xxx@develop/LICENSE.txt
(normal copy works fine!)
> cp LICENSE.txt sftp://mrf:xxx@develop/LICENSE.txt
com.jcraft.jsch.JSchException: UnknownHostKey
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(SftpFileSystem.java:120)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:138)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:104)
at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:919)
at org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:372)
at org.apache.commons.vfs.example.Shell.cp(Shell.java:215)
at org.apache.commons.vfs.example.Shell.handleCommand(Shell.java:151)
at org.apache.commons.vfs.example.Shell.go(Shell.java:127)
at org.apache.commons.vfs.example.Shell.main(Shell.java:90)
Command failed:
org.apache.commons.vfs.FileSystemException: Could not determine the type of file
"sftp://mrf:xxx@develop/LICENSE.txt".
at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:931)
at org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:372)
at org.apache.commons.vfs.example.Shell.cp(Shell.java:215)
at org.apache.commons.vfs.example.Shell.handleCommand(Shell.java:151)
at org.apache.commons.vfs.example.Shell.go(Shell.java:127)
at org.apache.commons.vfs.example.Shell.main(Shell.java:90)
Caused by: org.apache.commons.vfs.FileSystemException: Could not connect to SFTP server at
"sftp://mrf:xxx@develop/".
at org.apache.commons.vfs.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:140)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:138)
at org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:104)
at org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:919)
... 5 more
Caused by: com.jcraft.jsch.JSchException: UnknownHostKey
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(SftpFileSystem.java:120)
... 8 more
>
Any idea about the "UnknownHostKey"?
thanks,
Marcel
PS: The pure jsch-0.1.8/examples works fine:
java ScpTo XY mrf@develop:XY
PPS: Does VFS work with http://www.sshtools.com/
--
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [vfs] Howto setup sftp?
Posted by Marcel Ruff <ma...@marcelruff.info>.
Hi again,
ok, i have resolved this myself, i have added those lines to
commons-vfs/src/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java
======================
session.setPassword( rootName.getPassword() );
java.util.Properties config=new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
======================
(so i don't need to edit my .ssh/known_hosts)
The problem is that there is no way to configure ssh properties
from outside.
Commons-vfs is missing a way to transfer properties
to its 'file system' plugins.
But still the sftp task fails, now with a 'Permission denied'.
The same copy task runs fine with the bsch sample ScpTo.java.
I have compared the VFS code to the sample code from 'bsch'.
It appears that VFS uses
channel = (ChannelSftp)session.openChannel( "sftp" );
instead of
channel = (ChannelExec)session.openChannel( "exec" );
My question now is:
Has anybody ever used the commons-vfs SFTP code, or in other words:
Is it my configuration problem or did the VFS-SFTP code never work
properly?
thanks
Marcel
> Hi,
>
> i have downloaded commons-vfs-20031106.tar.gz
> and compiled in on Linux 2.4.21 with SUN JDK 1.4.1.
>
> I need to use the scp feature with 'sftp'.
> Is there any tutorial how to setup everything?
>
> Here is my problem:
>
> /opt/commons-vfs> java org.apache.commons.vfs.example.Shell
>
> > cp LICENSE.txt ftp://mrf:xxx@develop/LICENSE.txt
>
> (normal copy works fine!)
>
> > cp LICENSE.txt sftp://mrf:xxx@develop/LICENSE.txt
> com.jcraft.jsch.JSchException: UnknownHostKey
> 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(SftpFileSystem.java:120)
>
> at
> org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:138)
>
> at
> org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:104)
>
> at
> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:919)
>
> at
> org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:372)
>
> at org.apache.commons.vfs.example.Shell.cp(Shell.java:215)
> at
> org.apache.commons.vfs.example.Shell.handleCommand(Shell.java:151)
> at org.apache.commons.vfs.example.Shell.go(Shell.java:127)
> at org.apache.commons.vfs.example.Shell.main(Shell.java:90)
> Command failed:
> org.apache.commons.vfs.FileSystemException: Could not determine the
> type of file "sftp://mrf:xxx@develop/LICENSE.txt".
> at
> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:931)
>
> at
> org.apache.commons.vfs.provider.AbstractFileObject.exists(AbstractFileObject.java:372)
>
> at org.apache.commons.vfs.example.Shell.cp(Shell.java:215)
> at
> org.apache.commons.vfs.example.Shell.handleCommand(Shell.java:151)
> at org.apache.commons.vfs.example.Shell.go(Shell.java:127)
> at org.apache.commons.vfs.example.Shell.main(Shell.java:90)
> Caused by: org.apache.commons.vfs.FileSystemException: Could not
> connect to SFTP server at "sftp://mrf:xxx@develop/".
> at
> org.apache.commons.vfs.provider.sftp.SftpFileSystem.getChannel(SftpFileSystem.java:140)
>
> at
> org.apache.commons.vfs.provider.sftp.SftpFileObject.statSelf(SftpFileObject.java:138)
>
> at
> org.apache.commons.vfs.provider.sftp.SftpFileObject.doGetType(SftpFileObject.java:104)
>
> at
> org.apache.commons.vfs.provider.AbstractFileObject.attach(AbstractFileObject.java:919)
>
> ... 5 more
> Caused by: com.jcraft.jsch.JSchException: UnknownHostKey
> 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(SftpFileSystem.java:120)
>
> ... 8 more
> >
>
> Any idea about the "UnknownHostKey"?
>
> thanks,
>
> Marcel
>
> PS: The pure jsch-0.1.8/examples works fine:
>
> java ScpTo XY mrf@develop:XY
>
> PPS: Does VFS work with http://www.sshtools.com/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org