hi everyone,
im trying to run a linux script in java where it ask the user to input a password,then when suucessfully executed it prompts the user to enter the same password for verification,how can i do this in java,im using trilead to remotely access and execute command,im having problem when sending the password for verification.
im using sess.startshell();

thanks,any help will be much appreciated

Here is link to an example, date in code header shows it is old, but may prove to be useful. Also here few more

thanks,
but im using trilead,actually i can execute command as an su,but my problem is that when it prompts me for password again,it call a blank password eve i havent enter anything.any idea on how to do this..this is my code

sess=conn.openSession();
sess.requestDumbPTY();


if (Restart.equals("integration")) {
BufferedOutputStream  stdin = new BufferedOutputStream(sess.getStdin());
sess.startShell();


InputStream stdout = sess.getStdout();
InputStream stderr = sess.getStderr();


stdin.write(("su - postgres -c \"/etc/init.d/postgresql restart\"" + "\n").getBytes());
stdin.write((root_pass + "\n").getBytes());
stdout.read();
stdin.flush();
stdin.write((root_pass + "\n").getBytes());
stdin.flush();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.