JSCH sudo su komenda „tty” błąd

Polecenie Java - Jsch sudo.

Używam Jsch i moim zadaniem jest zalogować się do serwera i uruchomić polecenie jak poniżej

sudo su - bumboo

Korzystając z następującego kodu, z powodzeniem mogę się połączyć, ale gdy próbuję uruchomić polecenie, daje mi błądsudo: sorry, you must have a tty to run sudo

Oto mój kod

public static Channel sudoBamboo(Session session, String sudo_pass) throws Exception {

        ChannelExec channel = (ChannelExec) session.openChannel("exec");
        //SUDO to bamboo user
        String command = "sudo su - bumboo";
        channel.setCommand(command);

        //InputStream in = channel.getInputStream();
        channel.setInputStream(null, true);

        OutputStream out = channel.getOutputStream();
        //channel.setErrStream(System.err);
        channel.setOutputStream(System.out, true);
        channel.setExtOutputStream(System.err, true);
        //Test change
        //channel.setPty(false);
        channel.connect();

        out.write((sudo_pass + "\n").getBytes());
        out.flush();

        return channel;
    }

jsch w sudo.java dostępny przykład, którego radzili używać

// man sudo
      //   -S  The -S (stdin) option causes sudo to read the password from the
      //       standard input instead of the terminal device.
      //   -p  The -p (prompt) option allows you to override the default
      //       password prompt and use a custom one.
      ((ChannelExec)channel).setCommand("sudo -S -p '' "+command);

ale kiedy uruchamiam polecenie, takie jak"sudo -S -p - su bamboo" wciąż daje mi ten sam błąd

wszelka pomoc doceniana.

questionAnswers(1)

yourAnswerToTheQuestion