Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

pws vs iis vs apache, Trap timeout pdksh, nu vot, WWWXXXAPC, wwwxxxapc, WWWXXXAPC site:board.issociate.de, WWWXXXAPC site:board.issociate.de, WWWXXXAPC site:board.issociate.de, WWWXXXAPC site:board.issociate.de, iis is shit

Links

XODOX
Impressum

#1: Using sudo with Telnet

Posted on 2007-07-02 01:58:36 by dukelow

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
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Report this message

#2: RE: Using sudo with Telnet

Posted on 2007-07-02 12:23:34 by Brian Raven

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 =3D $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?

I'm not sure I understand you.

sudo is used to execute a command as another user, do you perhaps mean
su?

What happens when you type the same commands from the command line? Are
there any prompts generated that you need to respond to?

A small self contained example that illustrates the problem may also
help.

A small style issue. All upper case names are generally used for
constants. Variables generally have lower or mixed case. Small, as I
said, but it makes your code a little bit easier for other people to
read.

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Report this message

#3: Re: Using sudo with Telnet

Posted on 2007-07-02 21:42:20 by John Mason Jr

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.

You might try turning on debug and opening an Input_log.

Wireshark sometimes works well to capture the packets and reassemble the
conversation illustrating where the problem is occuring.


JOhn

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Report this message

#4: RE: Using sudo with Telnet

Posted on 2007-07-03 06:17:28 by Lyndon Rickards

> -----Original Message-----
> From: activeperl-bounces@listserv.ActiveState.com
> [mailto:activeperl-bounces@listserv.ActiveState.com] 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

Report this message