Net::Telnet getting control over root shell

  • Thread starter Ramprasad A Padmanabhan
  • Start date
R

Ramprasad A Padmanabhan

Hi,

I am using Net::Telnet and getting a new shell on a remote machine
all my commands work fine with

$telnet->cmd("foo") format

Now suppose I become root using "su" and "pass" I am not able to
execute commands on this root shell

Can anyone show me How I can do this

THanks
Ram
 
D

David Efflandt

I am using Net::Telnet and getting a new shell on a remote machine
all my commands work fine with

$telnet->cmd("foo") format

Now suppose I become root using "su" and "pass" I am not able to
execute commands on this root shell

First make sure that your script uses the Perl -T switch (see 'perldoc
perlsec').

Not that this has anything to do with Perl, but are you using "su -" or
just plain "su"? Without the "-" you retain the environment of the user
you were before, which may not have the PATH needed for many root
programs and could also screw up file permission or ownership for the
user you logged into telnet. Read 'man su'.
 
R

Richard Morse

Hi,

I am using Net::Telnet and getting a new shell on a remote machine
all my commands work fine with

$telnet->cmd("foo") format

Now suppose I become root using "su" and "pass" I am not able to
execute commands on this root shell

Can anyone show me How I can do this

Although I have _never_ used Net::Telnet, question about it seem to pop
up quite a bit. The problem is often in how the module recognizes the
"prompt". `su` can often change what the prompt looks like. Could this
be your problem?

Ricky
 
J

James Willmore

I am using Net::Telnet and getting a new shell on a remote machine
all my commands work fine with

$telnet->cmd("foo") format

Now suppose I become root using "su" and "pass" I am not able to execute
commands on this root shell

Can anyone show me How I can do this

This is just a guess ... you have to set your prompt to "Password", then
reset it to whatever the root prompt is. I'm thinking that your script
just hangs waiting for the root password.

To (dis)prove this, read the section of the Net::Telnet documentation on
debugging.

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
I am more bored than you could ever possibly be. Go back to
work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,394
Latest member
Olekdev

Latest Threads

Top