I\'m trying to execute below code to execute sudo commands but I do not know how execute commands after sudo login
String[] command
The sudo su executes a new shell.
To provide a command to the shell you either:
specify the command on su command-line, like the official JSch Sudo.java example shows:
((ChannelExec)channel).setCommand("sudo -S -p '' "+command);
or feed the command to the shell using its standard input, i.e. the same way you provide the password:
out.write(("command\n").getBytes());
See also Executing multiple bash commands using a Java JSch program after sudo login.
In general, I recommend the first approach as it uses a better defined API (command-line argument).