> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of John Mason Jr > Sent: Monday, July 02, 2007 3:42 PM > To: activeperl@listserv.ActiveState.com > Subject: Re: Using sudo with Telnet > > Dukelow, Don wrote: > > I've playing with Net::Telnet for a while now. Can anyone > tell me why > > when I telnet into another UNIX server and then sudo to > root, I can't > > capture the "cmd" output. If I execute a command as a user "my > > @RETURNED = $TELNET->cmd('uname -a');" the @RETURNED can be printed. > > But after I sudo to root the log files show that uname -a > is excited > > but the @RETURNED array doesn't have anything in it to print. > > Can anyone tell me how to get around this? > > > > ----- > > Don Dukelow > > > > Sounds like the connection is actually timing out, possibly > by the change in the prompt. >
An untested thought - if you are running sudo, which is an executable, it is likely grabbing output from the cmds you are subsequently running and they don't make it to telnet's STD handles. Try using a script on the remote machine that runs those commands with output redirected to a file then retrieve the content of that file. Not sure of sudo syntax.. $telnet->cmd('sudo root;uname -a > \tmp\mytempfile'); my @returned = $telnet->cmd('cat \tmp\mytempfile'); HTH - Lynn. _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs