Meaningless Drivel is fun!
The moose likes Sockets and Internet Protocols and the fly likes connecting to Unix Remote server using SSH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "connecting to Unix Remote server using SSH" Watch "connecting to Unix Remote server using SSH" New topic

connecting to Unix Remote server using SSH

Amar Naik
Ranch Hand

Joined: Sep 26, 2003
Posts: 43

i have an requirement where i need to connect to the Remote server (Unx box) using SSH. Once i have logged in i need to go to the specific directory and execute a script.

I have difficulty in how to connect to Remote Host using SSh thorugh java. Basically i need the system command to do it..CAnu please help me in this thing ..

Thank You
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13025
I found several references to Java libraries that support SSH and SSH2 by means of a Google search. For example:
Van Glass
Ranch Hand

Joined: Nov 18, 2000
Posts: 110
See the following article:

In particular you may wish to look at the Ssh/SshScript and SshSession classes found in SSH Factory which allow you to write scripted ssh sessions.
It is sorta covered in the JavaRanch Style Guide.
subject: connecting to Unix Remote server using SSH
jQuery in Action, 3rd edition