Executing multiple bash commands using a Java JSch program after sudo login
问题 I am trying to execute multiple bash commands through a Java program which connects to a SSH using JSch. But after sudo login, I am unable to execute any bash commands. From what I have read, after sudo login, we enter into a sub-shell. I wish to use a single channel. I am clueless as to what to do next. ChannelExec chnlex=(ChannelExec) session.openChannel("exec"); InputStream in = chnlex.getInputStream(); BufferedReader br=new BufferedReader(new InputStreamReader(in)); chnlex.setCommand(