Reputation: 11587
I am building a web service (Sevlets) which uses SSH to fetch informations from other remote servers. For the sake of simplicity I opted to use Apache commons exec library to do the ssh instead of using SSH Client implementions in Java like JSch. This implementation works fine in my developement environment but when I deploy it to the remote web server (A Red Hat Server with OpenSSH client) it fails with an error message.
ssh_exchange_identification: Connection closed by remote host
But when I ssh to the web server and restart the Apache Tomcat deamon, the SSH in my servlet code works until I terminate my SSH session with the web server and then fails with above message.
PS: I would prefer to abstain from using Java SSH client implementations as much as possible, because the ssh set-up in my environment is not straight forward and it involves setting up tunnels. Such set-ups are already done using the ssh config file and hence I would like to use that existing set-up as much as possible.
Upvotes: 0
Views: 670
Reputation: 442
Please check out if [Ganymed SSH library] (http://www.ganymed.ethz.ch/ssh2/) would help you. I've used it in one of my projects and found it easy and helpful.
Upvotes: 1