Thomas Sundberg

August 27, 2014

Run SSH from Java

Filed under: Automation, Java — Tags: , , , — Thomas Sundberg @ 21:19

This post is available at


  1. hi, thanks for the example. with the same code i am trying to run a bash program like session.execCommand(“process.ksh sample.txt” + path). is it doable, i also tried with Jcraft but no luck. Could you please let me know how do i run the job.


    Comment by Nur — February 3, 2016 @ 16:53

  2. Hi Nur!

    As far as I can tell, it should work. Given that the command you are trying to execute is valid and executable. Note that I use a shell command, ls, with some parameters. You should be able to do the very same.


    Comment by Thomas Sundberg — February 3, 2016 @ 17:53

  3. i was searching the net on how i can implement a dynamic port forwarding using java ssh api. but i noticed that the features is not available in “Ganymed SSH-2 for Java”
    i will be glad if i can get any help prior to this that can help me further my project

    Comment by tomide — June 12, 2016 @ 21:48

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: