Ejecutando el comando "sudo" en mi caja de Amazon EC2 usando la biblioteca java sshj

Estoy intentando ejecutar un comando sudo en mi máquina Amazon EC2 utilizando la biblioteca SSHJ (https://github.com/shikhar/sshj). Desafortunadamente, no estoy recibiendo ninguna respuesta del servidor. Estoy seguro de que los otros comandos que no son sudo se ejecutan a la perfección. Aquí hay un código de ejemplo.

        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        sshClient.addHostKeyVerifier(new PromiscuousVerifier());
        sshClient.connect(host, 22);

        if (privateKeyFile != null) {
            // authenticate using private key file.
            PKCS8KeyFile keyFile = new PKCS8KeyFile();
            keyFile.init(privateKeyFile);
            sshClient.authPublickey(user, keyFile);
        } else {
            // Authenticate using password.
            sshClient.authPassword(user, password);
        }

        // Start a new session
        session = sshClient.startSession();
        session.allocatePTY("vt220", 80,24,0,0,Collections.<PTYMode, Integer>emptyMap());

            Command cmd = null;
                String response = null;
            try (Session session = sshClient.startSession()) {
             cmd = session.exec("sudo service riak start");
             response = IOUtils.readFully(cmd.getInputStream()).toString();
        cmd.join(timeout, timeUnit);
                } finally {
        if (cmd != null) {
            cmd.close();
        }
    }

Respuestas a la pregunta(1)

Su respuesta a la pregunta