Rajeev - 2013-10-09

Hello EveryOne..

I'm trying to write a generic SSH client using JSch library which can handle all credential prompt configured at SSH server end.

To start with, I have created Session object using "shell.getSession(<hostname>)" rather than going with "shell.getSession(<username>, <hostname>, <portname>)" because I don't want JSch library to internally look for username prompt and send username. Pretty fine, session is getting connected and my code is working fine too!!

Now, I proceeded with creating Channel object using shell i.e "session.openChannel("shell")" and then tried to read the very first response sent by SSH server. Gr88, i got the response too, it's "login as:" in my case. Once I read this response, I know what I have to do, so I send username say "abc" to SSH server. Now once again I went with reading next response from SSH server. This time, I got "Password:" in response. Sounds good, I sent the password say "abc123". Here comes the problem now..
I am not getting the proper response now. Please note that my SSH server accept username as plain text and password is shown as "*". So do I need to encode my password before sending it?? If yes, how to do it?