ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52554] New: sshexec task: Add support for pseudo tty connections
Date Mon, 30 Jan 2012 03:47:21 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52554

             Bug #: 52554
           Summary: sshexec task: Add support for pseudo tty connections
           Product: Ant
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: richard.allwood@suncorp.com.au
    Classification: Unclassified


When using ssh to execute remote scripts containing "sudo" you get the
following error if /etc/sudoers contains "Defaults requiretty".

sudo: sorry, you must have a tty to run sudo

The solution is to edit your sudoers file or add support for pseudo tty
allocation (this is the same as the ssh -t option in unix).

Adding support for pseudo tty connections is a minor change:

In SSHExec.java
    private boolean tty = false;
    public void setTty(boolean tty) {
        this.tty = tty;
    }


    private void executeCommand(Session session, String cmd, StringBuffer sb)
...
            final ChannelExec channel;
            session.setTimeout((int) maxwait);
            /* execute the command */
            channel = (ChannelExec) session.openChannel("exec");
            channel.setCommand(cmd);
            channel.setOutputStream(tee);
            channel.setExtOutputStream(tee);
            if (istream != null) {
                channel.setInputStream(istream);
            }
+           channel.setPty(tty);
            channel.connect();

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message