Categorized | Techie

SFTP Java using JSch & OPENSsh

Posted on 12 May 2007

Sophisticated ! Do you know what is FTP or SFTP? If you don't know. Wikipedia will tell you. I had just completed writing a lightweight program to automate sending file to a server after extracted some records from database.

Due to our company standard transmission required all files sent throughout internet need to be encrypted, I will need to rewrite my Java program to sent the csv file format to a LAN SFTP before it will be schedule to push to vendor. The tricky part here is Java doesn't seem to have an SFTP protocol built in. The standard Java libraries only have FTP but no SFTP. So How? Buy la … OK, you can get it at very expensive price, but company will always want you to look for something FREE or you write it yourself. Huh?

Life is so miserable, earning so little yet doing so much ! After googling for about 2 hours, I found something useful here and hopefully if you guys is looking for something like my scenario, you can try to download OPENSsh & JSch.

OpenSSH is a FREE version of the SSH connectivity tools that technical users of the Internet rely on. Users of telnet, rlogin, and ftp may not realize that their password is transmitted across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other attacks. Additionally, OpenSSH provides secure tunneling capabilities and several authentication methods, and supports all SSH protocol versions.

JSch allows you to connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs. JSch is licensed under BSD style license.

Finally, here is how I workaround with my finding and the requirement. The reason I installed Openssh is for me to do testing locally. Installing and configuring Openssh is very easy, everything is clearly written in readme, all you need is just remember to start the services manually. Secondly is JSch, I use the ScpTo.java sample and modified it to include into my JAVA program. Everything looks fine and I don't even need to put extra effort to rewrite everything.

This post is solely written to Thanks JSch, Openssh and Open Source community and to help someone who is looking for solution like my case.

Thanks !

This post was written by:

Kenneth - who has written 139 posts on Million Ringgit Homepage.

I'm glad you're here, if you're new here, please click here to know more about this blog. You can subscribe to my RSS feed here. Thanks for your time and have a nice day.

Contact the author

Leave a Reply

(3 Users Online)