• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

SFTP over SSH2

Hi
I want to connect using SFTP over SSH2 !
I've tried jscape, unfortunately its not free
any <<< Free >>> library ?
any sample code ?
would be appreciated
0
hoomanv
Asked:
hoomanv
  • 5
  • 3
  • 2
  • +1
2 Solutions
 
hoomanvAuthor Commented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
hoomanvAuthor Commented:
JFTP ... actually this is a graphical ftp client. do you know any sample code using this lib ?

jscape is very simple as you can see below

            // create a new SshParameters instance with authentication info
            SshParameters sshParams = new SshParameters(host, user, password);
            // create a new Sftp instance
            Sftp sftp = new Sftp(sshParams);
            // establish a connection
            sftp.connect();
            // turn off auto transfer mode detection if enabled
            sftp.setAuto(false);
            // set transfer mode to binary
            sftp.setBinary();
            // download all files ending with .gif extension to current local directory
            sftp.mdownload("pass.txt");
            // disconnect from SSH server
            sftp.disconnect();

is there any free lib that is as simple as jscape ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
KantiCommented:
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Nopes, sorry. Might not be as simple. Have you tried the others on that page like JSch? It supports file transfer too.
0
 
hoomanvAuthor Commented:
> Have you tried the others on that page like JSch ?

I've downloaded it, but the problem is that I dont know how to use it.
Im realy looking for somthing easy like jakarta FTPClient or jscape which have been specifically written for FTP related operations

there are a lot of libs which support SSH2 but how to do FTP with them ?
0
 
girionisCommented:
Here you can find a few jsch examples: http://www.jcraft.com/jsch/examples/
0
 
hoomanvAuthor Commented:
although I had seen this sample code before but disregarded it (because of its low level impl), you made me try it and it worked as well

thanks anyway
0
 
girionisCommented:
Thank you for accepting, glad problem is solved :)
0
 
hoomanvAuthor Commented:
apparently, there is no javadoc for jsch :)
0
 
girionisCommented:
Nope :( it's not well documented. The only way is to look at the sample programmes and try to find out what each class does.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now