Search code examples
javalinuxsshdistributed-computing

Java library for interactive SSH session (to be able to do multi-part commands)?


I'm currently using a library for SSH within Java but it seems to be lacking the ability to do multipart commands (such as if I do passwd user I have no way of then entering the password twice to change it to because it makes you start a new session each time you enter a command). I really need this functionality for the current app I'm working on and there seems to be a lot of SSH libraries for Java but I am not sure which ones would allow this as some don't seem to.

Any advice on a good library to look at for this would be greatly appreciated.

To the close patrol: if you are going to try to close this, at least cite a thread that asks the same question as mine, not just a general "whats a good Java ssh library" question


Solution

  • I am using the Ganymede SSH-2 library with great success. However the password prompt shouldn't appear to the application at all, it should be part of the connection setup negotiation.