Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

All,
Apologies, but I recently posted a "NET::FTP" question. Of course, I really meant, NET::Telnet !

Same question though, I am trying to use the NET::Telnet package to remotely connect to a unix machine. However, we
have disabled remotely logging in as ROOT. Therefore I have to login as a regular user and then SU to root.

The problem comes when I try to issue the command "su - root". How do I deal with the fact that I am prompted to

enter the password ? I can't enter the password using the "cmd" operation as I just receive a timeout.

I know using Net::Telnet is not secure, what is the secure version in Perl ? Any help, much appeciated.

Replies are listed 'Best First'.
Re: NET::Telnet Help
by jens (Pilgrim) on Aug 27, 2002 at 05:23 UTC
    Take a look at the Expect module on CPAN. (in the CPAN module do an 'install Bundle::Expect'.)

    At a Perl Mongers meeting some months back, I saw a demonstration of Expect used to automate remote logins, file transfers, etc.

    From what I gather, Expect is a very powerful module. Check it out.

    Update: A little more research shows that Perl Expect is a rewrite of the original, Tcl-based Expect. The name comes from the old uucp/kermit days of "send/expect." You can do all sorts of wild and wonderful things with this module--automate all sorts of remote tasks!

Re: NET::Telnet Help
by krisahoch (Deacon) on Aug 27, 2002 at 11:16 UTC

    I know using Net::Telnet is not secure, what is the secure version in Perl ?
    ++

    Try using Net::SSH::Perl for all logins where you must use root . SSH is relatively secure, and it allows remote root logon to most systems.

    Kristofer A. Hoch