> Hi, 
> 
>   I am using Net::Telnet and getting a new shell on a remote machine
> all my commands work fine
> 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
> 

I believe you are going to need to use the read/wait_for idiom inside of
a loop simulating the command/output environment for the su subshell.

>From the Net::Telnet docs,

"Consider using a combination of print() and waitfor() as an alternative
to this method when it doesn't do what you want, e.g. the command you
send prompts for input."

Essentially once you have su'd you are going to be sent the su prompt,
wait for that, then do 'print' to send a command, then wait for the
prompt again, etc.

I *believe* (aka I haven't done it before) that this will work. Check
the Net::Telnet docs for much more information on this.  You might also
consider skipping the 'su' stuff altogether and see if sudo can be used
as an alternative.  Then you can have access to specific commands,
without a password if desired.

HTH,

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to