I am looking for a simple way to execute the ssh command in my java program. Basically I gather user input and based on their choices on hosts I want to execute the ssh command and let the linux shell command take over.
I have the feeling that a scripting language would be better suited but this is urgent and I have no experience in scripting.
I have tried something like the following based on info I gathered on the site:
Runtime.getRuntime().exec("ssh myusername@ipaddress");
However it doesn’t seem to work
Thanks in advance
Have you taken a look at Jsch? It seems to be what you need.
Scripting is super easy as well. Just take all the commands you would execute on a terminal and put them in the script. send in the arguments(usersnames/password,hosts,etc..) and you’re good to go.
Either way, good luck.