I have a Linux box, that after connecting to remotely will prompt the user to complete 3 parameters that will log the user's session details, i.e. name, group, reason.
I have some Java that connects using the JSch library but I am not sure how to send the strings and keys (not commands) via the Session object to complete these parameters. How is this done?
Below is a segment of my script, where I am attempting to connect to the host and then execute the LS command, but of course before it can do this it will need to send the 3 user session detail parameters.
Properties config = App.getConfig(args);
final PublicKeySshSession session = new PublicKeySshSession.Builder(
config.getProperty("host"),
config.getProperty("username"),
Integer.parseInt(config.getProperty("port")),
config.getProperty("privateKeyPath")).logger(new JschLogger()).build();
if (session == null) {
System.exit(-1);
}
session.execute("ls");
}
I thought I would include this segement of the code to make it clearer what I am aiming to achieve.