File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes SSH Public Key Authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "SSH Public Key Authentication" Watch "SSH Public Key Authentication" New topic

SSH Public Key Authentication

Dawn Thomas

Joined: Nov 05, 2007
Posts: 5
I was asked to integrate SSH public key authentication to my code (to avoid using passwords when logging into a server). I have searched the web but I'm not sure if I have the terms wrong - I'm not finding any examples. Does anyone know where I can look or can someone recommend a book?

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi Dawn,
For SSH public key authentication you can use JSCH API. Refer to this site where you can get the jar file as well as good examples.

Hope this help

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
What kind of communication are you trying to enable? SSH is used to open a terminal connection to a remote machine (like Telnet, only more secure). As such, it's rarely used in an application - you'd use the SSH client from the command line. Sometimes it's used to enable secure FTP transfers, though (and then it's called SFTP). So ... what exactly does this code do?
Dawn Thomas

Joined: Nov 05, 2007
Posts: 5
Thanks for your reply.

I need the code for 2 things:
1. to FTP a file from one location to another and
2. to login to the server and verify that a file exists in a specific location.

We do this right now using a username and password but these change quite often and it would be easier to use a token or key to login instead of a password.

I'll peruse the link you sent and see if it meets my needs.
I agree. Here's the link:
subject: SSH Public Key Authentication
jQuery in Action, 3rd edition