On Aug 4, 2013, at 2:20 AM, Andreas Schneider <a...@cryptomilk.org> wrote:
> On Tuesday 30 July 2013 09:14:59 William Orr wrote: >> Hi all, >> >> I'm trying to execute a command with sudo. sudo requires that I provide it >> with an ask pass program or have a PTY. Currently I have code that exec's >> a program on the remote end (called wshd, wshd exec's sudo), and then >> requests a PTY. This code returns an error reading "Channel request pty-req >> failed." If I request a PTY prior to exec'ing a command, wshd never gets >> exec'd. >> >> What I'm trying to do here is similar to `ssh -t <hostname> sudo whoami`, >> which exec's sudo, but also forces allocation of a PTY. >> >> I'm using libssh 0.5.4 on RHEL 6.1. Let me know if you need more >> information. >> >> http://bpaste.net/show/118708/ > > Did you read our tutorial? > > http://api.libssh.org/master/libssh_tutor_shell.html > > > Cheers, > > > -- andreas > > -- > Andreas Schneider GPG-ID: F33E3FC6 > www.cryptomilk.org a...@cryptomilk.org > > I did read your tutorial. I'm not looking to execute a shell, I'm looking to execute a single command, however sudo requires a PTY. So while I do see that I can request a PTY when requesting a shell, I'd like to request a PTY while exec'ing a single command. Like I said in my original post, it's the same behavior as ssh -t <host> <program name>