how to supply the password to a ssh client from java
1 posts in topic
Flat View  Flat View

Posted By:   Ionel_Condor
Posted On:   Monday, March 4, 2002 06:58 AM

Hi, I have a client (ssh client) and the ssh server...those standard in Linux. From a java application I try to connect to the client ssh using a classical Runtime.getRuntime.exec(arrayOfStrings). Now the problem is that such a client is interactive and it asks me the password, so I am trying to automate this process using the supplied OutputStream. This approache works fine for other applications that works interactively, but fails for ssh, and probably for other secured clients (I JUST SUPPOSE SO). Does anybody knows a solution, how can i send the password from my java application?
Many thanks, Ionel D. Condor.

Re: how to supply the password to a ssh client from java

Posted By:   Nathan_Meyers  
Posted On:   Tuesday, March 19, 2002 09:38 AM

Many applications requesting passwords open /dev/tty for reading the password, rather than reading from stdin. You can drive such applications by using pseudo-tty (pty) devices, which allow programs to control the "master" side of a tty-type connection.

Unfortunately, Java doesn't give you direct access to the calls that control pty devices. You can either write some JNI code to handle those details, or track down a utility called pty-redir that will redirect stdin/stdout to a pty.

About | Sitemap | Contact